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;
BITMAPOBJ *bitmap;
DC *dc;
PHYSDEV physdev;
if (!(dc = get_dc_ptr( hdc ))) return 0;
@ -632,7 +633,8 @@ static HGDIOBJ BITMAP_SelectObject( HGDIOBJ handle, HDC hdc )
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 );
ret = 0;

View File

@ -387,13 +387,15 @@ static HGDIOBJ BRUSH_SelectObject( HGDIOBJ handle, HDC hdc )
if ((brush = GDI_GetObjPtr( handle, OBJ_BRUSH )))
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSelectBrush );
if (brush->logbrush.lbStyle == BS_PATTERN)
BITMAP_SetOwnerDC( (HBITMAP)brush->logbrush.lbHatch, dc );
GDI_inc_ref_count( 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 );
}

View File

@ -2057,7 +2057,8 @@ COLORREF WINAPI SetDCBrushColor(HDC hdc, COLORREF crColor)
{
/* If DC_BRUSH is selected, update driver pen color */
HBRUSH hBrush = CreateSolidBrush( crColor );
dc->funcs->pSelectBrush( dc->physDev, hBrush );
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSelectBrush );
physdev->funcs->pSelectBrush( physdev, hBrush );
DeleteObject( hBrush );
}
@ -2122,7 +2123,8 @@ COLORREF WINAPI SetDCPenColor(HDC hdc, COLORREF crColor)
/* If DC_PEN is selected, update the driver pen color */
LOGPEN logpen = { PS_SOLID, { 0, 0 }, crColor };
HPEN hPen = CreatePenIndirect( &logpen );
dc->funcs->pSelectPen( dc->physDev, hPen );
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSelectPen );
physdev->funcs->pSelectPen( physdev, 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;
}
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 )
{
return TRUE;
@ -408,6 +413,31 @@ static BOOL CDECL nulldrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right,
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 )
{
}
@ -506,7 +536,7 @@ const DC_FUNCTIONS null_driver =
NULL, /* pCreateDIBSection */
NULL, /* pDeleteBitmap */
NULL, /* pDeleteDC */
NULL, /* pDeleteObject */
nulldrv_DeleteObject, /* pDeleteObject */
NULL, /* pDescribePixelFormat */
NULL, /* pDeviceCapabilities */
nulldrv_Ellipse, /* pEllipse */
@ -566,12 +596,12 @@ const DC_FUNCTIONS null_driver =
NULL, /* pSaveDC */
nulldrv_ScaleViewportExtEx, /* pScaleViewportExt */
nulldrv_ScaleWindowExtEx, /* pScaleWindowExt */
NULL, /* pSelectBitmap */
NULL, /* pSelectBrush */
nulldrv_SelectBitmap, /* pSelectBitmap */
nulldrv_SelectBrush, /* pSelectBrush */
NULL, /* pSelectClipPath */
NULL, /* pSelectFont */
NULL, /* pSelectPalette */
NULL, /* pSelectPen */
nulldrv_SelectFont, /* pSelectFont */
nulldrv_SelectPalette, /* pSelectPalette */
nulldrv_SelectPen, /* pSelectPen */
NULL, /* pSetArcDirection */
NULL, /* pSetBitmapBits */
NULL, /* pSetBkColor */

View File

@ -529,6 +529,7 @@ static HGDIOBJ FONT_SelectObject( HGDIOBJ handle, HDC hdc )
{
HGDIOBJ ret = 0;
DC *dc = get_dc_ptr( hdc );
PHYSDEV physdev;
if (!dc) return 0;
@ -541,7 +542,8 @@ static HGDIOBJ FONT_SelectObject( HGDIOBJ handle, HDC hdc )
if (GetDeviceCaps( dc->hSelf, TEXTCAPS ) & TC_VA_ABLE)
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;

View File

@ -845,12 +845,10 @@ BOOL WINAPI DeleteObject( HGDIOBJ obj )
if(dc)
{
if(dc->funcs->pDeleteObject)
{
GDI_ReleaseObj( obj ); /* release the GDI lock */
dc->funcs->pDeleteObject( dc->physDev, obj );
header = GDI_GetObjPtr( obj, 0 ); /* and grab it again */
}
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pDeleteObject );
GDI_ReleaseObj( obj ); /* release the GDI lock */
physdev->funcs->pDeleteObject( physdev, obj );
header = GDI_GetObjPtr( obj, 0 ); /* and grab it again */
release_dc_ptr( dc );
}
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 ret;
HPALETTE ret = 0;
DC *dc;
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);
return 0;
}
if (!(dc = get_dc_ptr( hdc ))) return 0;
ret = dc->hPalette;
if (dc->funcs->pSelectPalette) hpal = dc->funcs->pSelectPalette( dc->physDev, hpal, FALSE );
if (hpal)
if ((dc = get_dc_ptr( hdc )))
{
dc->hPalette = hpal;
if (!wBkg) hPrimaryPalette = hpal;
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSelectPalette );
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;
}

View File

@ -219,6 +219,7 @@ HPEN WINAPI ExtCreatePen( DWORD style, DWORD width,
*/
static HGDIOBJ PEN_SelectObject( HGDIOBJ handle, HDC hdc )
{
PHYSDEV physdev;
HGDIOBJ ret = 0;
DC *dc = get_dc_ptr( hdc );
@ -234,7 +235,8 @@ static HGDIOBJ PEN_SelectObject( HGDIOBJ handle, HDC hdc )
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 );
}