Commit 454b0fcb authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

gdi32: Store text color in DC_ATTR.

parent e13e935b
......@@ -262,7 +262,7 @@ static RGBQUAD get_dc_rgb_color( DC *dc, int color_table_size, COLORREF color )
void get_mono_dc_colors( DC *dc, int color_table_size, BITMAPINFO *info, int count )
{
info->bmiColors[count - 1] = get_dc_rgb_color( dc, color_table_size, dc->attr->background_color );
if (count > 1) info->bmiColors[0] = get_dc_rgb_color( dc, color_table_size, dc->textColor );
if (count > 1) info->bmiColors[0] = get_dc_rgb_color( dc, color_table_size, dc->attr->text_color );
info->bmiHeader.biClrUsed = count;
}
......
......@@ -90,7 +90,7 @@ static void set_initial_dc_state( DC *dc )
dc->attr->background_color = RGB( 255, 255, 255 );
dc->dcBrushColor = RGB( 255, 255, 255 );
dc->dcPenColor = RGB( 0, 0, 0 );
dc->textColor = RGB( 0, 0, 0 );
dc->attr->text_color = RGB( 0, 0, 0 );
dc->brush_org.x = 0;
dc->brush_org.y = 0;
dc->mapperFlags = 0;
......@@ -275,7 +275,7 @@ void DC_InitDC( DC* dc )
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pRealizeDefaultPalette );
physdev->funcs->pRealizeDefaultPalette( physdev );
SetTextColor( dc->hSelf, dc->textColor );
SetTextColor( dc->hSelf, dc->attr->text_color );
SetBkColor( dc->hSelf, dc->attr->background_color );
NtGdiSelectPen( dc->hSelf, dc->hPen );
NtGdiSelectBrush( dc->hSelf, dc->hBrush );
......@@ -401,7 +401,6 @@ INT CDECL nulldrv_SaveDC( PHYSDEV dev )
newdc->polyFillMode = dc->polyFillMode;
newdc->stretchBltMode = dc->stretchBltMode;
newdc->relAbsMode = dc->relAbsMode;
newdc->textColor = dc->textColor;
newdc->dcBrushColor = dc->dcBrushColor;
newdc->dcPenColor = dc->dcPenColor;
newdc->brush_org = dc->brush_org;
......@@ -475,7 +474,7 @@ BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level )
dc->relAbsMode = dcs->relAbsMode;
dc->attr->background_mode = dcs->attr->background_mode;
dc->attr->background_color = dcs->attr->background_color;
dc->textColor = dcs->textColor;
dc->attr->text_color = dcs->attr->text_color;
dc->dcBrushColor = dcs->dcBrushColor;
dc->dcPenColor = dcs->dcPenColor;
dc->brush_org = dcs->brush_org;
......@@ -527,7 +526,7 @@ BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level )
NtGdiSelectFont( dev->hdc, dcs->hFont );
NtGdiSelectPen( dev->hdc, dcs->hPen );
SetBkColor( dev->hdc, dcs->attr->background_color);
SetTextColor( dev->hdc, dcs->textColor);
SetTextColor( dev->hdc, dcs->attr->text_color);
GDISelectPalette( dev->hdc, dcs->hPalette, FALSE );
dc->saved_dc = dcs->saved_dc;
......@@ -930,22 +929,6 @@ COLORREF WINAPI SetBkColor( HDC hdc, COLORREF color )
/***********************************************************************
* GetTextColor (GDI32.@)
*/
COLORREF WINAPI GetTextColor( HDC hdc )
{
COLORREF ret = 0;
DC * dc = get_dc_ptr( hdc );
if (dc)
{
ret = dc->textColor;
release_dc_ptr( dc );
}
return ret;
}
/***********************************************************************
* SetTextColor (GDI32.@)
*/
COLORREF WINAPI SetTextColor( HDC hdc, COLORREF color )
......@@ -958,8 +941,8 @@ COLORREF WINAPI SetTextColor( HDC hdc, COLORREF color )
if (dc)
{
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetTextColor );
ret = dc->textColor;
dc->textColor = physdev->funcs->pSetTextColor( physdev, color );
ret = dc->attr->text_color;
dc->attr->text_color = physdev->funcs->pSetTextColor( physdev, color );
release_dc_ptr( dc );
}
return ret;
......
......@@ -937,7 +937,7 @@ UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, const RGBQUA
if (result) /* update colors of selected objects */
{
SetTextColor( hdc, dc->textColor );
SetTextColor( hdc, dc->attr->text_color );
SetBkColor( hdc, dc->attr->background_color );
NtGdiSelectPen( hdc, dc->hPen );
NtGdiSelectBrush( hdc, dc->hBrush );
......
......@@ -674,7 +674,7 @@ static inline void get_text_bkgnd_masks( DC *dc, const dib_info *dib, rop_mask *
mask->xor = get_pixel_color( dc, dib, bg, FALSE );
else
{
COLORREF fg = dc->textColor;
COLORREF fg = dc->attr->text_color;
mask->xor = get_pixel_color( dc, dib, fg, TRUE );
if (fg != bg) mask->xor = ~mask->xor;
}
......@@ -823,7 +823,7 @@ static void render_string( DC *dc, dib_info *dib, struct cached_font *font, INT
glyph_dib.bits.is_copy = FALSE;
glyph_dib.bits.free = NULL;
text_color = get_pixel_color( dc, dib, dc->textColor, TRUE );
text_color = get_pixel_color( dc, dib, dc->attr->text_color, TRUE );
if (glyph_dib.bit_count == 32)
intensity.gamma_ramp = dc->font_gamma_ramp;
......
......@@ -1981,7 +1981,7 @@ static BOOL select_pattern_brush( dibdrv_physdev *pdev, dib_brush *brush, BOOL *
BOOL got_pixel;
COLORREF color;
color = make_rgb_colorref( dc, &pdev->dib, dc->textColor, &got_pixel, &pixel );
color = make_rgb_colorref( dc, &pdev->dib, dc->attr->text_color, &got_pixel, &pixel );
color_table[0].rgbRed = GetRValue( color );
color_table[0].rgbGreen = GetGValue( color );
color_table[0].rgbBlue = GetBValue( color );
......
......@@ -5783,7 +5783,7 @@ BOOL CDECL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT
}
}
pen = CreatePen( PS_SOLID, 1, dc->textColor );
pen = CreatePen( PS_SOLID, 1, dc->attr->text_color );
orig = NtGdiSelectPen( dev->hdc, pen );
for (i = 0; i < count; i++)
......@@ -6238,7 +6238,7 @@ done:
OUTLINETEXTMETRICW* otm = NULL;
POINT pts[5];
HPEN hpen = NtGdiSelectPen(hdc, GetStockObject(NULL_PEN));
HBRUSH hbrush = CreateSolidBrush(dc->textColor);
HBRUSH hbrush = CreateSolidBrush( dc->attr->text_color );
hbrush = NtGdiSelectBrush(hdc, hbrush);
......
......@@ -75,6 +75,15 @@ COLORREF WINAPI GetBkColor( HDC hdc )
}
/***********************************************************************
* GetTextColor (GDI32.@)
*/
COLORREF WINAPI GetTextColor( HDC hdc )
{
DC_ATTR *dc_attr = get_dc_attr( hdc );
return dc_attr ? dc_attr->text_color : 0;
}
/***********************************************************************
* GetBkMode (GDI32.@)
*/
INT WINAPI GetBkMode( HDC hdc )
......
......@@ -119,7 +119,6 @@ typedef struct tagDC
WORD polyFillMode;
WORD stretchBltMode;
WORD relAbsMode;
COLORREF textColor;
COLORREF dcBrushColor;
COLORREF dcPenColor;
POINT brush_org;
......
......@@ -100,6 +100,7 @@ typedef struct DC_ATTR
{
LONG disabled; /* disabled flag, controled by DCHF_(DISABLE|ENABLE)DC */
COLORREF background_color;
COLORREF text_color;
POINT cur_pos;
INT graphics_mode;
DWORD layout;
......
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