gdi32: Take DPI awareness into account for the LOGPIXELSX/Y device caps.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
74a9c91964
commit
31967ef51d
|
@ -298,7 +298,6 @@ static BOOL nulldrv_GetCharWidth( PHYSDEV dev, UINT first, UINT last, INT *buffe
|
|||
|
||||
static INT nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
|
||||
{
|
||||
static int screen_dpi;
|
||||
int bpp;
|
||||
|
||||
switch (cap)
|
||||
|
@ -351,9 +350,7 @@ static INT nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
|
|||
case SHADEBLENDCAPS: return 0;
|
||||
case COLORMGMTCAPS: return 0;
|
||||
case LOGPIXELSX:
|
||||
case LOGPIXELSY:
|
||||
if (!screen_dpi && !(screen_dpi = get_dpi())) screen_dpi = 96;
|
||||
return screen_dpi;
|
||||
case LOGPIXELSY: return get_system_dpi();
|
||||
case NUMCOLORS:
|
||||
bpp = GetDeviceCaps( dev->hdc, BITSPIXEL );
|
||||
return (bpp > 8) ? -1 : (1 << bpp);
|
||||
|
|
|
@ -304,6 +304,7 @@ extern BOOL GDI_dec_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN;
|
|||
extern void GDI_hdc_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN;
|
||||
extern void GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN;
|
||||
extern DWORD get_dpi(void) DECLSPEC_HIDDEN;
|
||||
extern DWORD get_system_dpi(void) DECLSPEC_HIDDEN;
|
||||
|
||||
/* mapping.c */
|
||||
extern BOOL dp_to_lp( DC *dc, POINT *points, INT count ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -641,6 +641,24 @@ DWORD get_dpi(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* get_system_dpi
|
||||
*
|
||||
* Get the system DPI, based on the DPI awareness mode.
|
||||
*/
|
||||
DWORD get_system_dpi(void)
|
||||
{
|
||||
static UINT (WINAPI *pGetDpiForSystem)(void);
|
||||
|
||||
if (!pGetDpiForSystem)
|
||||
{
|
||||
static const WCHAR user32W[] = {'u','s','e','r','3','2','.','d','l','l',0};
|
||||
HMODULE user = GetModuleHandleW( user32W );
|
||||
if (user) pGetDpiForSystem = (void *)GetProcAddress( user, "GetDpiForSystem" );
|
||||
}
|
||||
return pGetDpiForSystem ? pGetDpiForSystem() : 96;
|
||||
}
|
||||
|
||||
static HFONT create_scaled_font( const LOGFONTW *deffont )
|
||||
{
|
||||
LOGFONTW lf;
|
||||
|
|
|
@ -3091,7 +3091,6 @@ static void test_dpi_aware(void)
|
|||
dpi = pGetDpiForSystem();
|
||||
ok( dpi == USER_DEFAULT_SCREEN_DPI, "wrong dpi %u\n", dpi );
|
||||
dpi = GetDeviceCaps( hdc, LOGPIXELSX );
|
||||
todo_wine_if (real_dpi != USER_DEFAULT_SCREEN_DPI)
|
||||
ok( dpi == USER_DEFAULT_SCREEN_DPI, "wrong dpi %u\n", dpi );
|
||||
ok( !pIsProcessDPIAware(), "still aware\n" );
|
||||
context = pGetThreadDpiAwarenessContext();
|
||||
|
|
Loading…
Reference in New Issue