Commit 75f792d7 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Add null driver entry points for SetDCBrush/PenColor.

parent 92859157
...@@ -2011,10 +2011,6 @@ DWORD WINAPI SetLayout(HDC hdc, DWORD layout) ...@@ -2011,10 +2011,6 @@ DWORD WINAPI SetLayout(HDC hdc, DWORD layout)
/*********************************************************************** /***********************************************************************
* GetDCBrushColor (GDI32.@) * GetDCBrushColor (GDI32.@)
*
* Retrieves the current brush color for the specified device
* context (DC).
*
*/ */
COLORREF WINAPI GetDCBrushColor(HDC hdc) COLORREF WINAPI GetDCBrushColor(HDC hdc)
{ {
...@@ -2035,11 +2031,6 @@ COLORREF WINAPI GetDCBrushColor(HDC hdc) ...@@ -2035,11 +2031,6 @@ COLORREF WINAPI GetDCBrushColor(HDC hdc)
/*********************************************************************** /***********************************************************************
* SetDCBrushColor (GDI32.@) * SetDCBrushColor (GDI32.@)
*
* Sets the current device context (DC) brush color to the specified
* color value. If the device cannot represent the specified color
* value, the color is set to the nearest physical color.
*
*/ */
COLORREF WINAPI SetDCBrushColor(HDC hdc, COLORREF crColor) COLORREF WINAPI SetDCBrushColor(HDC hdc, COLORREF crColor)
{ {
...@@ -2051,23 +2042,13 @@ COLORREF WINAPI SetDCBrushColor(HDC hdc, COLORREF crColor) ...@@ -2051,23 +2042,13 @@ COLORREF WINAPI SetDCBrushColor(HDC hdc, COLORREF crColor)
dc = get_dc_ptr( hdc ); dc = get_dc_ptr( hdc );
if (dc) if (dc)
{ {
if (dc->funcs->pSetDCBrushColor) PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetDCBrushColor );
crColor = dc->funcs->pSetDCBrushColor( dc->physDev, crColor ); crColor = physdev->funcs->pSetDCBrushColor( physdev, crColor );
else if (dc->hBrush == GetStockObject( DC_BRUSH ))
{
/* If DC_BRUSH is selected, update driver pen color */
HBRUSH hBrush = CreateSolidBrush( crColor );
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSelectBrush );
physdev->funcs->pSelectBrush( physdev, hBrush );
DeleteObject( hBrush );
}
if (crColor != CLR_INVALID) if (crColor != CLR_INVALID)
{ {
oldClr = dc->dcBrushColor; oldClr = dc->dcBrushColor;
dc->dcBrushColor = crColor; dc->dcBrushColor = crColor;
} }
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
...@@ -2076,10 +2057,6 @@ COLORREF WINAPI SetDCBrushColor(HDC hdc, COLORREF crColor) ...@@ -2076,10 +2057,6 @@ COLORREF WINAPI SetDCBrushColor(HDC hdc, COLORREF crColor)
/*********************************************************************** /***********************************************************************
* GetDCPenColor (GDI32.@) * GetDCPenColor (GDI32.@)
*
* Retrieves the current pen color for the specified device
* context (DC).
*
*/ */
COLORREF WINAPI GetDCPenColor(HDC hdc) COLORREF WINAPI GetDCPenColor(HDC hdc)
{ {
...@@ -2100,11 +2077,6 @@ COLORREF WINAPI GetDCPenColor(HDC hdc) ...@@ -2100,11 +2077,6 @@ COLORREF WINAPI GetDCPenColor(HDC hdc)
/*********************************************************************** /***********************************************************************
* SetDCPenColor (GDI32.@) * SetDCPenColor (GDI32.@)
*
* Sets the current device context (DC) pen color to the specified
* color value. If the device cannot represent the specified color
* value, the color is set to the nearest physical color.
*
*/ */
COLORREF WINAPI SetDCPenColor(HDC hdc, COLORREF crColor) COLORREF WINAPI SetDCPenColor(HDC hdc, COLORREF crColor)
{ {
...@@ -2116,24 +2088,13 @@ COLORREF WINAPI SetDCPenColor(HDC hdc, COLORREF crColor) ...@@ -2116,24 +2088,13 @@ COLORREF WINAPI SetDCPenColor(HDC hdc, COLORREF crColor)
dc = get_dc_ptr( hdc ); dc = get_dc_ptr( hdc );
if (dc) if (dc)
{ {
if (dc->funcs->pSetDCPenColor) PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetDCPenColor );
crColor = dc->funcs->pSetDCPenColor( dc->physDev, crColor ); crColor = physdev->funcs->pSetDCPenColor( physdev, crColor );
else if (dc->hPen == GetStockObject( DC_PEN ))
{
/* If DC_PEN is selected, update the driver pen color */
LOGPEN logpen = { PS_SOLID, { 0, 0 }, crColor };
HPEN hPen = CreatePenIndirect( &logpen );
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSelectPen );
physdev->funcs->pSelectPen( physdev, hPen );
DeleteObject( hPen );
}
if (crColor != CLR_INVALID) if (crColor != CLR_INVALID)
{ {
oldClr = dc->dcPenColor; oldClr = dc->dcPenColor;
dc->dcPenColor = crColor; dc->dcPenColor = crColor;
} }
release_dc_ptr( dc ); release_dc_ptr( dc );
} }
......
...@@ -438,6 +438,16 @@ static HPEN CDECL nulldrv_SelectPen( PHYSDEV dev, HPEN pen ) ...@@ -438,6 +438,16 @@ static HPEN CDECL nulldrv_SelectPen( PHYSDEV dev, HPEN pen )
return pen; return pen;
} }
static COLORREF CDECL nulldrv_SetDCBrushColor( PHYSDEV dev, COLORREF color )
{
return color;
}
static COLORREF CDECL nulldrv_SetDCPenColor( PHYSDEV dev, COLORREF color )
{
return color;
}
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 )
{ {
} }
...@@ -606,8 +616,8 @@ const DC_FUNCTIONS null_driver = ...@@ -606,8 +616,8 @@ const DC_FUNCTIONS null_driver =
NULL, /* pSetBitmapBits */ NULL, /* pSetBitmapBits */
NULL, /* pSetBkColor */ NULL, /* pSetBkColor */
NULL, /* pSetBkMode */ NULL, /* pSetBkMode */
NULL, /* pSetDCBrushColor */ nulldrv_SetDCBrushColor, /* pSetDCBrushColor */
NULL, /* pSetDCPenColor */ nulldrv_SetDCPenColor, /* pSetDCPenColor */
NULL, /* pSetDIBColorTable */ NULL, /* pSetDIBColorTable */
NULL, /* pSetDIBits */ NULL, /* pSetDIBits */
NULL, /* pSetDIBitsToDevice */ NULL, /* pSetDIBitsToDevice */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment