fix long-standing bug: resize image to fit the dialog for when the default
font size is changed (in Win2k, hidden away in display -> settings -> advanced -> general)
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
#include "RageSurface.h"
|
#include "RageSurface.h"
|
||||||
#include "RageSurfaceUtils.h"
|
#include "RageSurfaceUtils.h"
|
||||||
|
|
||||||
|
#include "RageSurfaceUtils_Zoom.h"
|
||||||
static HBITMAP g_hBitmap = NULL;
|
static HBITMAP g_hBitmap = NULL;
|
||||||
|
|
||||||
/* Load a RageSurface into a GDI surface. */
|
/* Load a RageSurface into a GDI surface. */
|
||||||
@@ -40,13 +41,26 @@ static HBITMAP LoadWin32Surface( RageSurface *&s )
|
|||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HBITMAP LoadWin32Surface( CString sFile )
|
static HBITMAP LoadWin32Surface( CString sFile, HWND hWnd )
|
||||||
{
|
{
|
||||||
CString error;
|
CString error;
|
||||||
RageSurface *pSurface = RageSurfaceUtils::LoadFile( sFile, error );
|
RageSurface *pSurface = RageSurfaceUtils::LoadFile( sFile, error );
|
||||||
if( pSurface == NULL )
|
if( pSurface == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
/* Resize the splash image to fit the dialog. Stretch to fit horizontally,
|
||||||
|
* maintaining aspect ratio. */
|
||||||
|
{
|
||||||
|
RECT r;
|
||||||
|
GetClientRect( hWnd, &r );
|
||||||
|
|
||||||
|
int iWidth = r.right;
|
||||||
|
float fRatio = (float) iWidth / pSurface->w;
|
||||||
|
int iHeight = lrintf( pSurface->h * fRatio );
|
||||||
|
|
||||||
|
RageSurfaceUtils::Zoom( pSurface, iWidth, iHeight );
|
||||||
|
}
|
||||||
|
|
||||||
HBITMAP ret = LoadWin32Surface( pSurface );
|
HBITMAP ret = LoadWin32Surface( pSurface );
|
||||||
delete pSurface;
|
delete pSurface;
|
||||||
return ret;
|
return ret;
|
||||||
@@ -57,9 +71,9 @@ BOOL CALLBACK LoadingWindow_Win32::WndProc( HWND hWnd, UINT msg, WPARAM wParam,
|
|||||||
switch( msg )
|
switch( msg )
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
g_hBitmap = LoadWin32Surface( "Data/splash.png" );
|
g_hBitmap = LoadWin32Surface( "Data/splash.png", hWnd );
|
||||||
if( g_hBitmap == NULL )
|
if( g_hBitmap == NULL )
|
||||||
g_hBitmap = LoadWin32Surface( "Data/splash.bmp" );
|
g_hBitmap = LoadWin32Surface( "Data/splash.bmp", hWnd );
|
||||||
SendMessage(
|
SendMessage(
|
||||||
GetDlgItem(hWnd,IDC_SPLASH),
|
GetDlgItem(hWnd,IDC_SPLASH),
|
||||||
STM_SETIMAGE,
|
STM_SETIMAGE,
|
||||||
|
|||||||
Reference in New Issue
Block a user