gdi32: Introduce get_gdi_object_type.
And use it instead of GetObjectType 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:
parent
856e8ea298
commit
a222f974c3
|
@ -866,7 +866,7 @@ BOOL WINAPI NtGdiTransparentBlt( HDC hdcDest, int xDest, int yDest, int widthDes
|
|||
if(oldStretchMode == BLACKONWHITE || oldStretchMode == WHITEONBLACK)
|
||||
SetStretchBltMode(hdcSrc, COLORONCOLOR);
|
||||
hdcWork = NtGdiCreateCompatibleDC( hdcDest );
|
||||
if ((GetObjectType( hdcDest ) != OBJ_MEMDC ||
|
||||
if ((get_gdi_object_type( hdcDest ) != NTGDI_OBJ_MEMDC ||
|
||||
NtGdiExtGetObjectW( NtGdiGetDCObject( hdcDest, NTGDI_OBJ_SURF ),
|
||||
sizeof(dib), &dib ) == sizeof(BITMAP)) &&
|
||||
NtGdiGetDeviceCaps( hdcDest, BITSPIXEL ) == 32)
|
||||
|
|
|
@ -58,7 +58,7 @@ HBITMAP WINAPI NtGdiCreateCompatibleBitmap( HDC hdc, INT width, INT height )
|
|||
|
||||
if (!width || !height) return 0;
|
||||
|
||||
if (GetObjectType( hdc ) != OBJ_MEMDC)
|
||||
if (get_gdi_object_type( hdc ) != NTGDI_OBJ_MEMDC)
|
||||
return NtGdiCreateBitmap( width, height,
|
||||
NtGdiGetDeviceCaps( hdc, PLANES ),
|
||||
NtGdiGetDeviceCaps( hdc, BITSPIXEL ), NULL );
|
||||
|
@ -373,7 +373,7 @@ HGDIOBJ WINAPI NtGdiSelectBitmap( HDC hdc, HGDIOBJ handle )
|
|||
|
||||
if (!(dc = get_dc_ptr( hdc ))) return 0;
|
||||
|
||||
if (GetObjectType( hdc ) != OBJ_MEMDC)
|
||||
if (get_gdi_object_type( hdc ) != NTGDI_OBJ_MEMDC)
|
||||
{
|
||||
ret = 0;
|
||||
goto done;
|
||||
|
|
|
@ -375,7 +375,7 @@ void DC_UpdateXforms( DC *dc )
|
|||
/* Reselect the font and pen back into the dc so that the size
|
||||
gets updated. */
|
||||
if (linear_xform_cmp( &oldworld2vport, &dc->xformWorld2Vport ) &&
|
||||
GetObjectType( dc->hSelf ) != OBJ_METADC)
|
||||
get_gdi_object_type( dc->hSelf ) != NTGDI_OBJ_METADC)
|
||||
{
|
||||
NtGdiSelectFont(dc->hSelf, dc->hFont);
|
||||
NtGdiSelectPen(dc->hSelf, dc->hPen);
|
||||
|
@ -1012,7 +1012,7 @@ BOOL WINAPI NtGdiGetDeviceGammaRamp( HDC hdc, void *ptr )
|
|||
TRACE("%p, %p\n", hdc, ptr);
|
||||
if( dc )
|
||||
{
|
||||
if (GetObjectType( hdc ) != OBJ_MEMDC)
|
||||
if (get_gdi_object_type( hdc ) != NTGDI_OBJ_MEMDC)
|
||||
{
|
||||
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetDeviceGammaRamp );
|
||||
ret = physdev->funcs->pGetDeviceGammaRamp( physdev, ptr );
|
||||
|
@ -1112,7 +1112,7 @@ BOOL WINAPI NtGdiSetDeviceGammaRamp( HDC hdc, void *ptr )
|
|||
TRACE( "%p, %p\n", hdc, ptr );
|
||||
if( dc )
|
||||
{
|
||||
if (GetObjectType( hdc ) != OBJ_MEMDC)
|
||||
if (get_gdi_object_type( hdc ) != NTGDI_OBJ_MEMDC)
|
||||
{
|
||||
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetDeviceGammaRamp );
|
||||
|
||||
|
|
|
@ -1689,8 +1689,8 @@ NTSTATUS WINAPI NtGdiDdDDIDestroyDCFromMemory( const D3DKMT_DESTROYDCFROMMEMORY
|
|||
|
||||
TRACE("dc %p, bitmap %p.\n", desc->hDc, desc->hBitmap);
|
||||
|
||||
if (GetObjectType( desc->hDc ) != OBJ_MEMDC ||
|
||||
GetObjectType( desc->hBitmap ) != OBJ_BITMAP) return STATUS_INVALID_PARAMETER;
|
||||
if (get_gdi_object_type( desc->hDc ) != NTGDI_OBJ_MEMDC ||
|
||||
get_gdi_object_type( desc->hBitmap ) != NTGDI_OBJ_BITMAP) return STATUS_INVALID_PARAMETER;
|
||||
NtGdiDeleteObjectApp( desc->hBitmap );
|
||||
NtGdiDeleteObjectApp( desc->hDc );
|
||||
|
||||
|
|
|
@ -816,6 +816,11 @@ void *free_gdi_handle( HGDIOBJ handle )
|
|||
return object;
|
||||
}
|
||||
|
||||
DWORD get_gdi_object_type( HGDIOBJ obj )
|
||||
{
|
||||
GDI_HANDLE_ENTRY *entry = handle_entry( obj );
|
||||
return entry ? entry->ExtType << NTGDI_HANDLE_TYPE_SHIFT : 0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* get_any_obj_ptr
|
||||
|
|
|
@ -383,6 +383,7 @@ extern BOOL GDI_dec_ref_count( HGDIOBJ handle ) DECLSPEC_HIDDEN;
|
|||
extern DWORD get_dpi(void) DECLSPEC_HIDDEN;
|
||||
extern DWORD get_system_dpi(void) DECLSPEC_HIDDEN;
|
||||
extern HGDIOBJ get_stock_object( INT obj ) DECLSPEC_HIDDEN;
|
||||
extern DWORD get_gdi_object_type( HGDIOBJ obj ) DECLSPEC_HIDDEN;
|
||||
|
||||
/* mapping.c */
|
||||
extern BOOL dp_to_lp( DC *dc, POINT *points, INT count ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -518,7 +518,7 @@ HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg)
|
|||
|
||||
TRACE("%p %p\n", hdc, hpal );
|
||||
|
||||
if (GetObjectType(hpal) != OBJ_PAL)
|
||||
if (get_gdi_object_type(hpal) != NTGDI_OBJ_PAL)
|
||||
{
|
||||
WARN("invalid selected palette %p\n",hpal);
|
||||
return 0;
|
||||
|
|
|
@ -1627,14 +1627,16 @@ static struct gdi_path *PATH_WidenPath(DC *dc)
|
|||
elp = HeapAlloc( GetProcessHeap(), 0, size );
|
||||
GetObjectW( dc->hPen, size, elp );
|
||||
|
||||
obj_type = GetObjectType(dc->hPen);
|
||||
if(obj_type == OBJ_PEN) {
|
||||
obj_type = get_gdi_object_type(dc->hPen);
|
||||
switch (obj_type)
|
||||
{
|
||||
case NTGDI_OBJ_PEN:
|
||||
penStyle = ((LOGPEN*)elp)->lopnStyle;
|
||||
}
|
||||
else if(obj_type == OBJ_EXTPEN) {
|
||||
break;
|
||||
case NTGDI_OBJ_EXTPEN:
|
||||
penStyle = elp->elpPenStyle;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
default:
|
||||
SetLastError(ERROR_CAN_NOT_COMPLETE);
|
||||
HeapFree( GetProcessHeap(), 0, elp );
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in New Issue