gdi32: Store DC brush color in DC_ATTR.

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:00:45 +02:00 committed by Alexandre Julliard
parent 600ed80b9b
commit e7abb54f43
5 changed files with 15 additions and 27 deletions

View File

@ -88,7 +88,7 @@ static void set_initial_dc_state( DC *dc )
dc->attr->rel_abs_mode = ABSOLUTE;
dc->attr->background_mode = OPAQUE;
dc->attr->background_color = RGB( 255, 255, 255 );
dc->dcBrushColor = RGB( 255, 255, 255 );
dc->attr->brush_color = RGB( 255, 255, 255 );
dc->dcPenColor = RGB( 0, 0, 0 );
dc->attr->text_color = RGB( 0, 0, 0 );
dc->brush_org.x = 0;
@ -398,7 +398,6 @@ INT CDECL nulldrv_SaveDC( PHYSDEV dev )
newdc->hFont = dc->hFont;
newdc->hBitmap = dc->hBitmap;
newdc->hPalette = dc->hPalette;
newdc->dcBrushColor = dc->dcBrushColor;
newdc->dcPenColor = dc->dcPenColor;
newdc->brush_org = dc->brush_org;
newdc->mapperFlags = dc->mapperFlags;
@ -470,7 +469,7 @@ BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level )
dc->attr->background_mode = dcs->attr->background_mode;
dc->attr->background_color = dcs->attr->background_color;
dc->attr->text_color = dcs->attr->text_color;
dc->dcBrushColor = dcs->dcBrushColor;
dc->attr->brush_color = dcs->attr->brush_color;
dc->dcPenColor = dcs->dcPenColor;
dc->brush_org = dcs->brush_org;
dc->mapperFlags = dcs->mapperFlags;
@ -1479,26 +1478,6 @@ DWORD WINAPI SetLayout(HDC hdc, DWORD layout)
return oldlayout;
}
/***********************************************************************
* GetDCBrushColor (GDI32.@)
*/
COLORREF WINAPI GetDCBrushColor(HDC hdc)
{
DC *dc;
COLORREF dcBrushColor = CLR_INVALID;
TRACE("hdc(%p)\n", hdc);
dc = get_dc_ptr( hdc );
if (dc)
{
dcBrushColor = dc->dcBrushColor;
release_dc_ptr( dc );
}
return dcBrushColor;
}
/***********************************************************************
* SetDCBrushColor (GDI32.@)
*/
@ -1516,8 +1495,8 @@ COLORREF WINAPI SetDCBrushColor(HDC hdc, COLORREF crColor)
crColor = physdev->funcs->pSetDCBrushColor( physdev, crColor );
if (crColor != CLR_INVALID)
{
oldClr = dc->dcBrushColor;
dc->dcBrushColor = crColor;
oldClr = dc->attr->brush_color;
dc->attr->brush_color = crColor;
}
release_dc_ptr( dc );
}

View File

@ -2137,7 +2137,7 @@ HBRUSH CDECL dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush, const struct brush_
GetObjectW( hbrush, sizeof(logbrush), &logbrush );
if (hbrush == GetStockObject( DC_BRUSH ))
logbrush.lbColor = dc->dcBrushColor;
logbrush.lbColor = dc->attr->brush_color;
select_brush( pdev, &pdev->brush, &logbrush, pattern, TRUE );
return hbrush;

View File

@ -74,6 +74,15 @@ COLORREF WINAPI GetBkColor( HDC hdc )
return dc_attr ? dc_attr->background_color : CLR_INVALID;
}
/***********************************************************************
* GetDCBrushColor (GDI32.@)
*/
COLORREF WINAPI GetDCBrushColor( HDC hdc )
{
DC_ATTR *dc_attr = get_dc_attr( hdc );
return dc_attr ? dc_attr->brush_color : CLR_INVALID;
}
/***********************************************************************
* GetTextColor (GDI32.@)
*/

View File

@ -116,7 +116,6 @@ typedef struct tagDC
const struct font_gamma_ramp *font_gamma_ramp;
UINT font_code_page;
COLORREF dcBrushColor;
COLORREF dcPenColor;
POINT brush_org;

View File

@ -100,6 +100,7 @@ typedef struct DC_ATTR
{
LONG disabled; /* disabled flag, controled by DCHF_(DISABLE|ENABLE)DC */
COLORREF background_color;
COLORREF brush_color;
COLORREF text_color;
POINT cur_pos;
INT graphics_mode;