gdi32: Use NtGdiGetDeviceCaps for GetDeviceCaps implementation.

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-07-30 13:03:15 +02:00 committed by Alexandre Julliard
parent 2a6adcdc0f
commit c129d13cbd
5 changed files with 23 additions and 5 deletions

View File

@ -799,9 +799,9 @@ HDC WINAPI ResetDCW( HDC hdc, const DEVMODEW *devmode )
/***********************************************************************
* GetDeviceCaps (GDI32.@)
* NtGdiGetDeviceCaps (win32u.@)
*/
INT WINAPI GetDeviceCaps( HDC hdc, INT cap )
INT WINAPI NtGdiGetDeviceCaps( HDC hdc, INT cap )
{
DC *dc;
INT ret = 0;

View File

@ -53,6 +53,7 @@ extern BOOL METADC_ExtTextOut( HDC hdc, INT x, INT y, UINT flags, const RECT *re
const WCHAR *str, UINT count, const INT *dx ) DECLSPEC_HIDDEN;
extern BOOL METADC_FillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush ) DECLSPEC_HIDDEN;
extern BOOL METADC_FrameRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush, INT x, INT y ) DECLSPEC_HIDDEN;
extern INT METADC_GetDeviceCaps( HDC hdc, INT cap );
extern BOOL METADC_InvertRgn( HDC hdc, HRGN hrgn ) DECLSPEC_HIDDEN;
extern BOOL METADC_LineTo( HDC hdc, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL METADC_MoveTo( HDC hdc, INT x, INT y ) DECLSPEC_HIDDEN;

View File

@ -125,6 +125,16 @@ INT WINAPI SaveDC( HDC hdc )
return NtGdiSaveDC( hdc );
}
/***********************************************************************
* GetDeviceCaps (GDI32.@)
*/
INT WINAPI GetDeviceCaps( HDC hdc, INT cap )
{
if (is_meta_dc( hdc )) return METADC_GetDeviceCaps( hdc, cap );
if (!get_dc_attr( hdc )) return FALSE;
return NtGdiGetDeviceCaps( hdc, cap );
}
/***********************************************************************
* GetTextAlign (GDI32.@)
*/

View File

@ -78,12 +78,14 @@ static UINT CDECL MFDRV_SetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
/******************************************************************
* MFDRV_GetDeviceCaps
* METADC_GetDeviceCaps
*
*A very simple implementation that returns DT_METAFILE
*/
static INT CDECL MFDRV_GetDeviceCaps(PHYSDEV dev, INT cap)
INT METADC_GetDeviceCaps( HDC hdc, INT cap )
{
if (!get_metadc_ptr( hdc )) return 0;
switch(cap)
{
case TECHNOLOGY:
@ -137,7 +139,7 @@ static const struct gdi_dc_funcs MFDRV_Funcs =
NULL, /* pGetCharABCWidthsI */
NULL, /* pGetCharWidth */
NULL, /* pGetCharWidthInfo */
MFDRV_GetDeviceCaps, /* pGetDeviceCaps */
NULL, /* pGetDeviceCaps */
NULL, /* pGetDeviceGammaRamp */
NULL, /* pGetFontData */
NULL, /* pGetFontRealizationInfo */

View File

@ -89,6 +89,11 @@ static void test_dc_values(void)
attr = GetBkColor(ULongToHandle(0xdeadbeef));
ok(attr == CLR_INVALID, "attr = %x\n", attr);
SetLastError(0xdeadbeef);
attr = GetDeviceCaps(ULongToHandle(0xdeadbeef), TECHNOLOGY);
ok(!attr, "GetDeviceCaps rets %d\n", attr);
ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %u\n", GetLastError());
DeleteDC( hdc );
}