win32u: Directly use NtGdiGetDeviceCaps in ntgdi functions.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-09-14 21:52:46 +02:00 committed by Alexandre Julliard
parent ad4f9396e0
commit d3d6b832a3
6 changed files with 31 additions and 32 deletions

View file

@ -397,7 +397,7 @@ HGDIOBJ WINAPI NtGdiSelectBitmap( HDC hdc, HGDIOBJ handle )
if (!is_bitmapobj_dib( bitmap ) &&
bitmap->dib.dsBm.bmBitsPixel != 1 &&
bitmap->dib.dsBm.bmBitsPixel != GetDeviceCaps( hdc, BITSPIXEL ))
bitmap->dib.dsBm.bmBitsPixel != NtGdiGetDeviceCaps( hdc, BITSPIXEL ))
{
WARN( "Wrong format bitmap %u bpp\n", bitmap->dib.dsBm.bmBitsPixel );
GDI_ReleaseObj( handle );

View file

@ -130,8 +130,8 @@ static inline void create_default_clip_region( DC * dc )
{
rect.left = 0;
rect.top = 0;
rect.right = GetDeviceCaps( dc->hSelf, DESKTOPHORZRES );
rect.bottom = GetDeviceCaps( dc->hSelf, DESKTOPVERTRES );
rect.right = NtGdiGetDeviceCaps( dc->hSelf, DESKTOPHORZRES );
rect.bottom = NtGdiGetDeviceCaps( dc->hSelf, DESKTOPVERTRES );
}
dc->hClipRgn = CreateRectRgnIndirect( &rect );
}

View file

@ -693,8 +693,8 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
dc->attr->vis_rect.left = 0;
dc->attr->vis_rect.top = 0;
dc->attr->vis_rect.right = GetDeviceCaps( hdc, DESKTOPHORZRES );
dc->attr->vis_rect.bottom = GetDeviceCaps( hdc, DESKTOPVERTRES );
dc->attr->vis_rect.right = NtGdiGetDeviceCaps( hdc, DESKTOPHORZRES );
dc->attr->vis_rect.bottom = NtGdiGetDeviceCaps( hdc, DESKTOPVERTRES );
DC_InitDC( dc );
release_dc_ptr( dc );
@ -775,8 +775,8 @@ BOOL WINAPI NtGdiResetDC( HDC hdc, const DEVMODEW *devmode, BOOL *banding,
dc->dirty = 0;
dc->attr->vis_rect.left = 0;
dc->attr->vis_rect.top = 0;
dc->attr->vis_rect.right = GetDeviceCaps( hdc, DESKTOPHORZRES );
dc->attr->vis_rect.bottom = GetDeviceCaps( hdc, DESKTOPVERTRES );
dc->attr->vis_rect.right = NtGdiGetDeviceCaps( hdc, DESKTOPHORZRES );
dc->attr->vis_rect.bottom = NtGdiGetDeviceCaps( hdc, DESKTOPVERTRES );
if (dc->hVisRgn) NtGdiDeleteObjectApp( dc->hVisRgn );
dc->hVisRgn = 0;
update_dc_clipping( dc );

View file

@ -382,10 +382,10 @@ static INT CDECL nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
{
case DRIVERVERSION: return 0x4000;
case TECHNOLOGY: return DT_RASDISPLAY;
case HORZSIZE: return MulDiv( GetDeviceCaps( dev->hdc, HORZRES ), 254,
GetDeviceCaps( dev->hdc, LOGPIXELSX ) * 10 );
case VERTSIZE: return MulDiv( GetDeviceCaps( dev->hdc, VERTRES ), 254,
GetDeviceCaps( dev->hdc, LOGPIXELSY ) * 10 );
case HORZSIZE: return MulDiv( NtGdiGetDeviceCaps( dev->hdc, HORZRES ), 254,
NtGdiGetDeviceCaps( dev->hdc, LOGPIXELSX ) * 10 );
case VERTSIZE: return MulDiv( NtGdiGetDeviceCaps( dev->hdc, VERTRES ), 254,
NtGdiGetDeviceCaps( dev->hdc, LOGPIXELSY ) * 10 );
case HORZRES:
{
DC *dc = get_nulldrv_dc( dev );
@ -424,7 +424,7 @@ static INT CDECL nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
WCHAR *display;
DC *dc;
if (GetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY && pEnumDisplaySettingsW)
if (NtGdiGetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY && pEnumDisplaySettingsW)
{
dc = get_nulldrv_dc( dev );
display = dc->display[0] ? dc->display : NULL;
@ -454,11 +454,11 @@ static INT CDECL nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
case CLIPCAPS: return CP_RECTANGLE;
case RASTERCAPS: return (RC_BITBLT | RC_BITMAP64 | RC_GDI20_OUTPUT | RC_DI_BITMAP | RC_DIBTODEV |
RC_BIGFONT | RC_STRETCHBLT | RC_FLOODFILL | RC_STRETCHDIB | RC_DEVBITS |
(GetDeviceCaps( dev->hdc, SIZEPALETTE ) ? RC_PALETTE : 0));
(NtGdiGetDeviceCaps( dev->hdc, SIZEPALETTE ) ? RC_PALETTE : 0));
case ASPECTX: return 36;
case ASPECTY: return 36;
case ASPECTXY: return (int)(hypot( GetDeviceCaps( dev->hdc, ASPECTX ),
GetDeviceCaps( dev->hdc, ASPECTY )) + 0.5);
case ASPECTXY: return (int)(hypot( NtGdiGetDeviceCaps( dev->hdc, ASPECTX ),
NtGdiGetDeviceCaps( dev->hdc, ASPECTY )) + 0.5);
case CAPS1: return 0;
case SIZEPALETTE: return 0;
case NUMRESERVED: return 20;
@ -474,7 +474,7 @@ static INT CDECL nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
WCHAR *display;
DC *dc;
if (GetDeviceCaps( dev->hdc, TECHNOLOGY ) != DT_RASDISPLAY)
if (NtGdiGetDeviceCaps( dev->hdc, TECHNOLOGY ) != DT_RASDISPLAY)
return 0;
if (pEnumDisplaySettingsW)
@ -491,7 +491,7 @@ static INT CDECL nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
return 1;
}
case DESKTOPHORZRES:
if (GetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY && pGetSystemMetrics)
if (NtGdiGetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY && pGetSystemMetrics)
{
DPI_AWARENESS_CONTEXT context;
UINT ret;
@ -500,9 +500,9 @@ static INT CDECL nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
pSetThreadDpiAwarenessContext( context );
return ret;
}
return GetDeviceCaps( dev->hdc, HORZRES );
return NtGdiGetDeviceCaps( dev->hdc, HORZRES );
case DESKTOPVERTRES:
if (GetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY && pGetSystemMetrics)
if (NtGdiGetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY && pGetSystemMetrics)
{
DPI_AWARENESS_CONTEXT context;
UINT ret;
@ -511,14 +511,14 @@ static INT CDECL nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
pSetThreadDpiAwarenessContext( context );
return ret;
}
return GetDeviceCaps( dev->hdc, VERTRES );
return NtGdiGetDeviceCaps( dev->hdc, VERTRES );
case BLTALIGNMENT: return 0;
case SHADEBLENDCAPS: return 0;
case COLORMGMTCAPS: return 0;
case LOGPIXELSX:
case LOGPIXELSY: return get_system_dpi();
case NUMCOLORS:
bpp = GetDeviceCaps( dev->hdc, BITSPIXEL );
bpp = NtGdiGetDeviceCaps( dev->hdc, BITSPIXEL );
return (bpp > 8) ? -1 : (1 << bpp);
case COLORRES:
/* The observed correspondence between BITSPIXEL and COLORRES is:
@ -526,7 +526,7 @@ static INT CDECL nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
* BITSPIXEL: 16 -> COLORRES: 16
* BITSPIXEL: 24 -> COLORRES: 24
* BITSPIXEL: 32 -> COLORRES: 24 */
bpp = GetDeviceCaps( dev->hdc, BITSPIXEL );
bpp = NtGdiGetDeviceCaps( dev->hdc, BITSPIXEL );
return (bpp <= 8) ? 18 : min( 24, bpp );
default:
FIXME("(%p): unsupported capability %d, will return 0\n", dev->hdc, cap );

View file

@ -35,8 +35,8 @@ static SIZE get_dc_virtual_size( DC *dc )
if (!ret.cx)
{
ret.cx = GetDeviceCaps( dc->hSelf, HORZSIZE );
ret.cy = GetDeviceCaps( dc->hSelf, VERTSIZE );
ret.cx = NtGdiGetDeviceCaps( dc->hSelf, HORZSIZE );
ret.cy = NtGdiGetDeviceCaps( dc->hSelf, VERTSIZE );
}
return ret;
}
@ -47,8 +47,8 @@ static SIZE get_dc_virtual_res( DC *dc )
if (!ret.cx)
{
ret.cx = GetDeviceCaps( dc->hSelf, HORZRES );
ret.cy = GetDeviceCaps( dc->hSelf, VERTRES );
ret.cx = NtGdiGetDeviceCaps( dc->hSelf, HORZRES );
ret.cy = NtGdiGetDeviceCaps( dc->hSelf, VERTRES );
}
return ret;
}
@ -387,11 +387,11 @@ BOOL WINAPI NtGdiModifyWorldTransform( HDC hdc, const XFORM *xform, DWORD mode )
* FALSE if any (but not all) of the last four params are zero.
*
* NOTES
* This doesn't change the values returned by GetDeviceCaps, just the
* This doesn't change the values returned by NtGdiGetDeviceCaps, just the
* scaling of the mapping modes.
*
* Calling with the last four params equal to zero sets the values
* back to their defaults obtained by calls to GetDeviceCaps.
* back to their defaults obtained by calls to NtGdiGetDeviceCaps.
*/
BOOL WINAPI NtGdiSetVirtualResolution( HDC hdc, DWORD horz_res, DWORD vert_res,
DWORD horz_size, DWORD vert_size )

View file

@ -304,9 +304,8 @@ UINT WINAPI NtGdiSetSystemPaletteUse( HDC hdc, UINT use )
UINT old = SystemPaletteUse;
/* Device doesn't support colour palettes */
if (!(GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE)) {
if (!(NtGdiGetDeviceCaps( hdc, RASTERCAPS ) & RC_PALETTE))
return SYSPAL_ERROR;
}
switch (use) {
case SYSPAL_NOSTATIC:
@ -400,7 +399,7 @@ COLORREF CDECL nulldrv_GetNearestColor( PHYSDEV dev, COLORREF color )
unsigned char spec_type;
DC *dc = get_nulldrv_dc( dev );
if (!(GetDeviceCaps( dev->hdc, RASTERCAPS ) & RC_PALETTE)) return color;
if (!(NtGdiGetDeviceCaps( dev->hdc, RASTERCAPS ) & RC_PALETTE)) return color;
spec_type = color >> 24;
if (spec_type == 1 || spec_type == 2)
@ -582,7 +581,7 @@ typedef BOOL (WINAPI *RedrawWindow_funcptr)( HWND, const RECT *, HRGN, UINT );
BOOL WINAPI NtGdiUpdateColors( HDC hDC )
{
HMODULE mod;
int size = GetDeviceCaps( hDC, SIZEPALETTE );
int size = NtGdiGetDeviceCaps( hDC, SIZEPALETTE );
if (!size) return FALSE;