gdi32: Add null driver entry points for the object selection functions.

This commit is contained in:
Alexandre Julliard 2011-03-09 21:19:09 +01:00
parent 6d9ebd05a5
commit adc63287b5
8 changed files with 67 additions and 27 deletions

View File

@ -600,6 +600,7 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
HGDIOBJ ret; HGDIOBJ ret;
BITMAPOBJ *bitmap; BITMAPOBJ *bitmap;
DC *dc; DC *dc;
PHYSDEV physdev;
if (!(dc = get_dc_ptr( hdc ))) return 0; if (!(dc = get_dc_ptr( hdc ))) return 0;
@ -632,7 +633,8 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
goto done; goto done;
} }
if (dc->funcs->pSelectBitmap && !dc->funcs->pSelectBitmap( dc->physDev, handle )) physdev = GET_DC_PHYSDEV( dc, pSelectBitmap );
if (!physdev->funcs->pSelectBitmap( physdev, handle ))
{ {
GDI_ReleaseObj( handle ); GDI_ReleaseObj( handle );
ret = 0; ret = 0;

View File

@ -387,13 +387,15 @@ static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc )
if ((brush = GDI_GetObjPtr( handle, OBJ_BRUSH ))) if ((brush = GDI_GetObjPtr( handle, OBJ_BRUSH )))
{ {
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSelectBrush );
if (brush->logbrush.lbStyle == BS_PATTERN) if (brush->logbrush.lbStyle == BS_PATTERN)
BITMAP_SetOwnerDC( (HBITMAP)brush->logbrush.lbHatch, dc ); BITMAP_SetOwnerDC( (HBITMAP)brush->logbrush.lbHatch, dc );
GDI_inc_ref_count( handle ); GDI_inc_ref_count( handle );
GDI_ReleaseObj( handle ); GDI_ReleaseObj( handle );
if (dc->funcs->pSelectBrush && !dc->funcs->pSelectBrush( dc->physDev, handle )) if (!physdev->funcs->pSelectBrush( physdev, handle ))
{ {
GDI_dec_ref_count( handle ); GDI_dec_ref_count( handle );
} }

View File

@ -2057,7 +2057,8 @@ COLORREF WINAPI SetDCBrushColor(HDC hdc, COLORREF crColor)
{ {
/* If DC_BRUSH is selected, update driver pen color */ /* If DC_BRUSH is selected, update driver pen color */
HBRUSH hBrush = CreateSolidBrush( crColor ); HBRUSH hBrush = CreateSolidBrush( crColor );
dc->funcs->pSelectBrush( dc->physDev, hBrush ); PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSelectBrush );
physdev->funcs->pSelectBrush( physdev, hBrush );
DeleteObject( hBrush ); DeleteObject( hBrush );
} }
@ -2122,7 +2123,8 @@ COLORREF WINAPI SetDCPenColor(HDC hdc, COLORREF crColor)
/* If DC_PEN is selected, update the driver pen color */ /* If DC_PEN is selected, update the driver pen color */
LOGPEN logpen = { PS_SOLID, { 0, 0 }, crColor }; LOGPEN logpen = { PS_SOLID, { 0, 0 }, crColor };
HPEN hPen = CreatePenIndirect( &logpen ); HPEN hPen = CreatePenIndirect( &logpen );
dc->funcs->pSelectPen( dc->physDev, hPen ); PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSelectPen );
physdev->funcs->pSelectPen( physdev, hPen );
DeleteObject( hPen ); DeleteObject( hPen );
} }

View File

@ -329,6 +329,11 @@ static BOOL CDECL nulldrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT
return TRUE; return TRUE;
} }
static BOOL CDECL nulldrv_DeleteObject( PHYSDEV dev, HGDIOBJ obj )
{
return TRUE;
}
static BOOL CDECL nulldrv_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) static BOOL CDECL nulldrv_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
{ {
return TRUE; return TRUE;
@ -408,6 +413,31 @@ static BOOL CDECL nulldrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right,
return TRUE; return TRUE;
} }
static HBITMAP CDECL nulldrv_SelectBitmap( PHYSDEV dev, HBITMAP bitmap )
{
return bitmap;
}
static HBRUSH CDECL nulldrv_SelectBrush( PHYSDEV dev, HBRUSH brush )
{
return brush;
}
static HFONT CDECL nulldrv_SelectFont( PHYSDEV dev, HFONT font, HANDLE gdi_font )
{
return 0;
}
static HPALETTE CDECL nulldrv_SelectPalette( PHYSDEV dev, HPALETTE palette, BOOL bkgnd )
{
return palette;
}
static HPEN CDECL nulldrv_SelectPen( PHYSDEV dev, HPEN pen )
{
return pen;
}
static void CDECL nulldrv_SetDeviceClipping( PHYSDEV dev, HRGN vis_rgn, HRGN clip_rgn ) static void CDECL nulldrv_SetDeviceClipping( PHYSDEV dev, HRGN vis_rgn, HRGN clip_rgn )
{ {
} }
@ -506,7 +536,7 @@ const DC_FUNCTIONS null_driver =
NULL, /* pCreateDIBSection */ NULL, /* pCreateDIBSection */
NULL, /* pDeleteBitmap */ NULL, /* pDeleteBitmap */
NULL, /* pDeleteDC */ NULL, /* pDeleteDC */
NULL, /* pDeleteObject */ nulldrv_DeleteObject, /* pDeleteObject */
NULL, /* pDescribePixelFormat */ NULL, /* pDescribePixelFormat */
NULL, /* pDeviceCapabilities */ NULL, /* pDeviceCapabilities */
nulldrv_Ellipse, /* pEllipse */ nulldrv_Ellipse, /* pEllipse */
@ -566,12 +596,12 @@ const DC_FUNCTIONS null_driver =
NULL, /* pSaveDC */ NULL, /* pSaveDC */
nulldrv_ScaleViewportExtEx, /* pScaleViewportExt */ nulldrv_ScaleViewportExtEx, /* pScaleViewportExt */
nulldrv_ScaleWindowExtEx, /* pScaleWindowExt */ nulldrv_ScaleWindowExtEx, /* pScaleWindowExt */
NULL, /* pSelectBitmap */ nulldrv_SelectBitmap, /* pSelectBitmap */
NULL, /* pSelectBrush */ nulldrv_SelectBrush, /* pSelectBrush */
NULL, /* pSelectClipPath */ NULL, /* pSelectClipPath */
NULL, /* pSelectFont */ nulldrv_SelectFont, /* pSelectFont */
NULL, /* pSelectPalette */ nulldrv_SelectPalette, /* pSelectPalette */
NULL, /* pSelectPen */ nulldrv_SelectPen, /* pSelectPen */
NULL, /* pSetArcDirection */ NULL, /* pSetArcDirection */
NULL, /* pSetBitmapBits */ NULL, /* pSetBitmapBits */
NULL, /* pSetBkColor */ NULL, /* pSetBkColor */

View File

@ -529,6 +529,7 @@ static HGDIOBJ FONT_SelectObject( HGDIOBJ handle, HDC hdc )
{ {
HGDIOBJ ret = 0; HGDIOBJ ret = 0;
DC *dc = get_dc_ptr( hdc ); DC *dc = get_dc_ptr( hdc );
PHYSDEV physdev;
if (!dc) return 0; if (!dc) return 0;
@ -541,7 +542,8 @@ static HGDIOBJ FONT_SelectObject( HGDIOBJ handle, HDC hdc )
if (GetDeviceCaps( dc->hSelf, TEXTCAPS ) & TC_VA_ABLE) if (GetDeviceCaps( dc->hSelf, TEXTCAPS ) & TC_VA_ABLE)
dc->gdiFont = WineEngCreateFontInstance( dc, handle ); dc->gdiFont = WineEngCreateFontInstance( dc, handle );
if (dc->funcs->pSelectFont) ret = dc->funcs->pSelectFont( dc->physDev, handle, dc->gdiFont ); physdev = GET_DC_PHYSDEV( dc, pSelectFont );
ret = physdev->funcs->pSelectFont( physdev, handle, dc->gdiFont );
if (ret && dc->gdiFont) dc->gdiFont = 0; if (ret && dc->gdiFont) dc->gdiFont = 0;

View File

@ -845,12 +845,10 @@ BOOL WINAPI DeleteObject( HGDIOBJ obj )
if(dc) if(dc)
{ {
if(dc->funcs->pDeleteObject) PHYSDEV physdev = GET_DC_PHYSDEV( dc, pDeleteObject );
{ GDI_ReleaseObj( obj ); /* release the GDI lock */
GDI_ReleaseObj( obj ); /* release the GDI lock */ physdev->funcs->pDeleteObject( physdev, obj );
dc->funcs->pDeleteObject( dc->physDev, obj ); header = GDI_GetObjPtr( obj, 0 ); /* and grab it again */
header = GDI_GetObjPtr( obj, 0 ); /* and grab it again */
}
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
HeapFree(GetProcessHeap(), 0, hdcs_head); HeapFree(GetProcessHeap(), 0, hdcs_head);

View File

@ -689,7 +689,7 @@ static BOOL PALETTE_DeleteObject( HGDIOBJ handle )
*/ */
HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg) HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg)
{ {
HPALETTE ret; HPALETTE ret = 0;
DC *dc; DC *dc;
TRACE("%p %p\n", hdc, hpal ); TRACE("%p %p\n", hdc, hpal );
@ -699,16 +699,18 @@ HPALETTE WINAPI GDISelectPalette( HDC hdc, HPALETTE hpal, WORD wBkg)
WARN("invalid selected palette %p\n",hpal); WARN("invalid selected palette %p\n",hpal);
return 0; return 0;
} }
if (!(dc = get_dc_ptr( hdc ))) return 0; if ((dc = get_dc_ptr( hdc )))
ret = dc->hPalette;
if (dc->funcs->pSelectPalette) hpal = dc->funcs->pSelectPalette( dc->physDev, hpal, FALSE );
if (hpal)
{ {
dc->hPalette = hpal; PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSelectPalette );
if (!wBkg) hPrimaryPalette = hpal; ret = dc->hPalette;
if (physdev->funcs->pSelectPalette( physdev, hpal, FALSE ))
{
dc->hPalette = hpal;
if (!wBkg) hPrimaryPalette = hpal;
}
else ret = 0;
release_dc_ptr( dc );
} }
else ret = 0;
release_dc_ptr( dc );
return ret; return ret;
} }

View File

@ -219,6 +219,7 @@ HPEN WINAPI ExtCreatePen( DWORD style, DWORD width,
*/ */
static HGDIOBJ PEN_SelectObject( HGDIOBJ handle, HDC hdc ) static HGDIOBJ PEN_SelectObject( HGDIOBJ handle, HDC hdc )
{ {
PHYSDEV physdev;
HGDIOBJ ret = 0; HGDIOBJ ret = 0;
DC *dc = get_dc_ptr( hdc ); DC *dc = get_dc_ptr( hdc );
@ -234,7 +235,8 @@ static HGDIOBJ PEN_SelectObject( HGDIOBJ handle, HDC hdc )
return 0; return 0;
} }
if (dc->funcs->pSelectPen && !dc->funcs->pSelectPen( dc->physDev, handle )) physdev = GET_DC_PHYSDEV( dc, pSelectPen );
if (!physdev->funcs->pSelectPen( physdev, handle ))
{ {
GDI_dec_ref_count( handle ); GDI_dec_ref_count( handle );
} }