gdi32: Store DC pen 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:54 +02:00 committed by Alexandre Julliard
parent e7abb54f43
commit b9ffa2bf26
5 changed files with 15 additions and 27 deletions

View File

@ -89,7 +89,7 @@ static void set_initial_dc_state( DC *dc )
dc->attr->background_mode = OPAQUE;
dc->attr->background_color = RGB( 255, 255, 255 );
dc->attr->brush_color = RGB( 255, 255, 255 );
dc->dcPenColor = RGB( 0, 0, 0 );
dc->attr->pen_color = RGB( 0, 0, 0 );
dc->attr->text_color = RGB( 0, 0, 0 );
dc->brush_org.x = 0;
dc->brush_org.y = 0;
@ -398,7 +398,6 @@ INT CDECL nulldrv_SaveDC( PHYSDEV dev )
newdc->hFont = dc->hFont;
newdc->hBitmap = dc->hBitmap;
newdc->hPalette = dc->hPalette;
newdc->dcPenColor = dc->dcPenColor;
newdc->brush_org = dc->brush_org;
newdc->mapperFlags = dc->mapperFlags;
newdc->charExtra = dc->charExtra;
@ -470,7 +469,7 @@ BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level )
dc->attr->background_color = dcs->attr->background_color;
dc->attr->text_color = dcs->attr->text_color;
dc->attr->brush_color = dcs->attr->brush_color;
dc->dcPenColor = dcs->dcPenColor;
dc->attr->pen_color = dcs->attr->pen_color;
dc->brush_org = dcs->brush_org;
dc->mapperFlags = dcs->mapperFlags;
dc->attr->text_align = dcs->attr->text_align;
@ -1504,26 +1503,6 @@ COLORREF WINAPI SetDCBrushColor(HDC hdc, COLORREF crColor)
return oldClr;
}
/***********************************************************************
* GetDCPenColor (GDI32.@)
*/
COLORREF WINAPI GetDCPenColor(HDC hdc)
{
DC *dc;
COLORREF dcPenColor = CLR_INVALID;
TRACE("hdc(%p)\n", hdc);
dc = get_dc_ptr( hdc );
if (dc)
{
dcPenColor = dc->dcPenColor;
release_dc_ptr( dc );
}
return dcPenColor;
}
/***********************************************************************
* SetDCPenColor (GDI32.@)
*/
@ -1541,8 +1520,8 @@ COLORREF WINAPI SetDCPenColor(HDC hdc, COLORREF crColor)
crColor = physdev->funcs->pSetDCPenColor( physdev, crColor );
if (crColor != CLR_INVALID)
{
oldClr = dc->dcPenColor;
dc->dcPenColor = crColor;
oldClr = dc->attr->pen_color;
dc->attr->pen_color = crColor;
}
release_dc_ptr( dc );
}

View File

@ -2189,7 +2189,7 @@ HPEN CDECL dibdrv_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern
pdev->pen_width = get_pen_device_width( dc, logpen.lopnWidth.x );
if (hpen == GetStockObject( DC_PEN ))
logbrush.lbColor = dc->dcPenColor;
logbrush.lbColor = dc->attr->pen_color;
set_dash_pattern( &pdev->pen_pattern, 0, NULL );
select_brush( pdev, &pdev->pen_brush, &logbrush, pattern, dither );

View File

@ -83,6 +83,15 @@ COLORREF WINAPI GetDCBrushColor( HDC hdc )
return dc_attr ? dc_attr->brush_color : CLR_INVALID;
}
/***********************************************************************
* GetDCPenColor (GDI32.@)
*/
COLORREF WINAPI GetDCPenColor(HDC hdc)
{
DC_ATTR *dc_attr = get_dc_attr( hdc );
return dc_attr ? dc_attr->pen_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 dcPenColor;
POINT brush_org;
DWORD mapperFlags; /* Font mapper flags */

View File

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