mirror of https://github.com/PCSX2/pcsx2.git
gui:windows: Implement image DPI scaling
This should reproduce the old non-DPI aware pre-wxWidgets 3.0 behaviour for the main dialogs, except the font rendering should be better. And add comments that I should have already added but didn't.
This commit is contained in:
parent
59ffed85ba
commit
bcc125ceb6
|
@ -21,6 +21,8 @@
|
||||||
#include <wx/wfstream.h>
|
#include <wx/wfstream.h>
|
||||||
#include <wx/imaglist.h>
|
#include <wx/imaglist.h>
|
||||||
|
|
||||||
|
#include "MSWstuff.h"
|
||||||
|
|
||||||
#include "Resources/EmbeddedImage.h"
|
#include "Resources/EmbeddedImage.h"
|
||||||
#include "Resources/BackgroundLogo.h"
|
#include "Resources/BackgroundLogo.h"
|
||||||
#include "Resources/ButtonIcon_Camera.h"
|
#include "Resources/ButtonIcon_Camera.h"
|
||||||
|
@ -145,7 +147,8 @@ const wxBitmap& Pcsx2App::GetLogoBitmap()
|
||||||
wxImage img;
|
wxImage img;
|
||||||
EmbeddedImage<res_BackgroundLogo> temp; // because gcc can't allow non-const temporaries.
|
EmbeddedImage<res_BackgroundLogo> temp; // because gcc can't allow non-const temporaries.
|
||||||
LoadImageAny( img, useTheme, mess, L"BackgroundLogo", temp );
|
LoadImageAny( img, useTheme, mess, L"BackgroundLogo", temp );
|
||||||
logo = new wxBitmap( img );
|
float scale = MSW_GetDPIScale(); // 1.0 for non-Windows
|
||||||
|
logo = new wxBitmap(img.Scale(img.GetWidth() * scale, img.GetHeight() * scale, wxIMAGE_QUALITY_HIGH));
|
||||||
|
|
||||||
return *logo;
|
return *logo;
|
||||||
}
|
}
|
||||||
|
@ -167,7 +170,8 @@ const wxBitmap& Pcsx2App::GetScreenshotBitmap()
|
||||||
wxImage img;
|
wxImage img;
|
||||||
EmbeddedImage<res_ButtonIcon_Camera> temp; // because gcc can't allow non-const temporaries.
|
EmbeddedImage<res_ButtonIcon_Camera> temp; // because gcc can't allow non-const temporaries.
|
||||||
LoadImageAny(img, useTheme, mess, L"ButtonIcon_Camera", temp);
|
LoadImageAny(img, useTheme, mess, L"ButtonIcon_Camera", temp);
|
||||||
screenshot = new wxBitmap(img);
|
float scale = MSW_GetDPIScale(); // 1.0 for non-Windows
|
||||||
|
screenshot = new wxBitmap(img.Scale(img.GetWidth() * scale, img.GetHeight() * scale, wxIMAGE_QUALITY_HIGH));
|
||||||
|
|
||||||
return *screenshot;
|
return *screenshot;
|
||||||
}
|
}
|
||||||
|
@ -177,7 +181,7 @@ wxImageList& Pcsx2App::GetImgList_Config()
|
||||||
ScopedPtr<wxImageList>& images( GetResourceCache().ConfigImages );
|
ScopedPtr<wxImageList>& images( GetResourceCache().ConfigImages );
|
||||||
if( !images )
|
if( !images )
|
||||||
{
|
{
|
||||||
int image_size = g_Conf->Listbook_ImageSize;
|
int image_size = MSW_GetDPIScale() * g_Conf->Listbook_ImageSize;
|
||||||
images = new wxImageList(image_size, image_size);
|
images = new wxImageList(image_size, image_size);
|
||||||
wxFileName mess;
|
wxFileName mess;
|
||||||
bool useTheme = (g_Conf->DeskTheme != L"default");
|
bool useTheme = (g_Conf->DeskTheme != L"default");
|
||||||
|
@ -219,6 +223,7 @@ wxImageList& Pcsx2App::GetImgList_Config()
|
||||||
return *images;
|
return *images;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This stuff seems unused?
|
||||||
wxImageList& Pcsx2App::GetImgList_Toolbars()
|
wxImageList& Pcsx2App::GetImgList_Toolbars()
|
||||||
{
|
{
|
||||||
ScopedPtr<wxImageList>& images( GetResourceCache().ToolbarImages );
|
ScopedPtr<wxImageList>& images( GetResourceCache().ToolbarImages );
|
||||||
|
|
|
@ -28,11 +28,13 @@ void MSW_SetWindowAfter( WXWidget hwnd, WXWidget hwndAfter )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Text scales automatically on Windows but that's about it. The dialog widths
|
||||||
|
// and images need to be scaled manually.
|
||||||
float MSW_GetDPIScale()
|
float MSW_GetDPIScale()
|
||||||
{
|
{
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
HDC screen = GetDC(0);
|
HDC screen = GetDC(0);
|
||||||
float scale = GetDeviceCaps(screen, LOGPIXELSX) / 96.0;
|
float scale = GetDeviceCaps(screen, LOGPIXELSX) / 96.0; // 96.0 dpi = 100% scale
|
||||||
ReleaseDC(NULL, screen);
|
ReleaseDC(NULL, screen);
|
||||||
|
|
||||||
return scale;
|
return scale;
|
||||||
|
|
Loading…
Reference in New Issue