gdi32: Move background color to 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:
parent
148a2b60a5
commit
6a2decc259
|
@ -261,7 +261,7 @@ static RGBQUAD get_dc_rgb_color( DC *dc, int color_table_size, COLORREF color )
|
|||
/* helper to retrieve either both colors or only the background color for monochrome blits */
|
||||
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->backgroundColor );
|
||||
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 );
|
||||
info->bmiHeader.biClrUsed = count;
|
||||
}
|
||||
|
|
|
@ -86,8 +86,8 @@ static void set_initial_dc_state( DC *dc )
|
|||
dc->polyFillMode = ALTERNATE;
|
||||
dc->stretchBltMode = BLACKONWHITE;
|
||||
dc->relAbsMode = ABSOLUTE;
|
||||
dc->attr->background_mode = OPAQUE;
|
||||
dc->backgroundColor = RGB( 255, 255, 255 );
|
||||
dc->attr->background_mode = OPAQUE;
|
||||
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 );
|
||||
|
@ -276,7 +276,7 @@ void DC_InitDC( DC* dc )
|
|||
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pRealizeDefaultPalette );
|
||||
physdev->funcs->pRealizeDefaultPalette( physdev );
|
||||
SetTextColor( dc->hSelf, dc->textColor );
|
||||
SetBkColor( dc->hSelf, dc->backgroundColor );
|
||||
SetBkColor( dc->hSelf, dc->attr->background_color );
|
||||
NtGdiSelectPen( dc->hSelf, dc->hPen );
|
||||
NtGdiSelectBrush( dc->hSelf, dc->hBrush );
|
||||
NtGdiSelectFont( dc->hSelf, dc->hFont );
|
||||
|
@ -401,7 +401,6 @@ INT CDECL nulldrv_SaveDC( PHYSDEV dev )
|
|||
newdc->polyFillMode = dc->polyFillMode;
|
||||
newdc->stretchBltMode = dc->stretchBltMode;
|
||||
newdc->relAbsMode = dc->relAbsMode;
|
||||
newdc->backgroundColor = dc->backgroundColor;
|
||||
newdc->textColor = dc->textColor;
|
||||
newdc->dcBrushColor = dc->dcBrushColor;
|
||||
newdc->dcPenColor = dc->dcPenColor;
|
||||
|
@ -474,8 +473,8 @@ BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level )
|
|||
dc->polyFillMode = dcs->polyFillMode;
|
||||
dc->stretchBltMode = dcs->stretchBltMode;
|
||||
dc->relAbsMode = dcs->relAbsMode;
|
||||
dc->attr->background_mode = dcs->attr->background_mode;
|
||||
dc->backgroundColor = dcs->backgroundColor;
|
||||
dc->attr->background_mode = dcs->attr->background_mode;
|
||||
dc->attr->background_color = dcs->attr->background_color;
|
||||
dc->textColor = dcs->textColor;
|
||||
dc->dcBrushColor = dcs->dcBrushColor;
|
||||
dc->dcPenColor = dcs->dcPenColor;
|
||||
|
@ -527,7 +526,7 @@ BOOL CDECL nulldrv_RestoreDC( PHYSDEV dev, INT level )
|
|||
NtGdiSelectBrush( dev->hdc, dcs->hBrush );
|
||||
NtGdiSelectFont( dev->hdc, dcs->hFont );
|
||||
NtGdiSelectPen( dev->hdc, dcs->hPen );
|
||||
SetBkColor( dev->hdc, dcs->backgroundColor);
|
||||
SetBkColor( dev->hdc, dcs->attr->background_color);
|
||||
SetTextColor( dev->hdc, dcs->textColor);
|
||||
GDISelectPalette( dev->hdc, dcs->hPalette, FALSE );
|
||||
|
||||
|
@ -909,22 +908,6 @@ INT WINAPI GetDeviceCaps( HDC hdc, INT cap )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* GetBkColor (GDI32.@)
|
||||
*/
|
||||
COLORREF WINAPI GetBkColor( HDC hdc )
|
||||
{
|
||||
COLORREF ret = 0;
|
||||
DC * dc = get_dc_ptr( hdc );
|
||||
if (dc)
|
||||
{
|
||||
ret = dc->backgroundColor;
|
||||
release_dc_ptr( dc );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SetBkColor (GDI32.@)
|
||||
*/
|
||||
|
@ -938,8 +921,8 @@ COLORREF WINAPI SetBkColor( HDC hdc, COLORREF color )
|
|||
if (dc)
|
||||
{
|
||||
PHYSDEV physdev = GET_DC_PHYSDEV( dc, pSetBkColor );
|
||||
ret = dc->backgroundColor;
|
||||
dc->backgroundColor = physdev->funcs->pSetBkColor( physdev, color );
|
||||
ret = dc->attr->background_color;
|
||||
dc->attr->background_color = physdev->funcs->pSetBkColor( physdev, color );
|
||||
release_dc_ptr( dc );
|
||||
}
|
||||
return ret;
|
||||
|
|
|
@ -938,7 +938,7 @@ UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, const RGBQUA
|
|||
if (result) /* update colors of selected objects */
|
||||
{
|
||||
SetTextColor( hdc, dc->textColor );
|
||||
SetBkColor( hdc, dc->backgroundColor );
|
||||
SetBkColor( hdc, dc->attr->background_color );
|
||||
NtGdiSelectPen( hdc, dc->hPen );
|
||||
NtGdiSelectBrush( hdc, dc->hBrush );
|
||||
}
|
||||
|
|
|
@ -666,7 +666,7 @@ static struct cached_glyph *get_cached_glyph( struct cached_font *font, UINT ind
|
|||
*/
|
||||
static inline void get_text_bkgnd_masks( DC *dc, const dib_info *dib, rop_mask *mask )
|
||||
{
|
||||
COLORREF bg = dc->backgroundColor;
|
||||
COLORREF bg = dc->attr->background_color;
|
||||
|
||||
mask->and = 0;
|
||||
|
||||
|
|
|
@ -193,8 +193,8 @@ DWORD get_pixel_color( DC *dc, const dib_info *dib, COLORREF color, BOOL mono_fi
|
|||
if(rgbquad_equal(&fg_quad, color_table + 1))
|
||||
return 1;
|
||||
|
||||
pixel = get_pixel_color( dc, dib, dc->backgroundColor, FALSE );
|
||||
if (color == dc->backgroundColor) return pixel;
|
||||
pixel = get_pixel_color( dc, dib, dc->attr->background_color, FALSE );
|
||||
if (color == dc->attr->background_color) return pixel;
|
||||
else return !pixel;
|
||||
}
|
||||
|
||||
|
@ -219,8 +219,8 @@ static inline void get_color_masks( DC *dc, const dib_info *dib, UINT rop, COLOR
|
|||
return;
|
||||
}
|
||||
|
||||
if (dib->bit_count != 1) color = get_pixel_color( dc, dib, dc->backgroundColor, FALSE );
|
||||
else if (colorref != dc->backgroundColor) color = !color;
|
||||
if (dib->bit_count != 1) color = get_pixel_color( dc, dib, dc->attr->background_color, FALSE );
|
||||
else if (colorref != dc->attr->background_color) color = !color;
|
||||
|
||||
calc_rop_masks( rop, color, bg_mask );
|
||||
}
|
||||
|
@ -1896,7 +1896,7 @@ static BOOL create_hatch_brush_bits(dibdrv_physdev *pdev, dib_brush *brush, BOOL
|
|||
|
||||
if (brush->colorref & (1 << 24)) /* PALETTEINDEX */
|
||||
*needs_reselect = TRUE;
|
||||
if (dc->attr->background_mode != TRANSPARENT && (dc->backgroundColor & (1 << 24)))
|
||||
if (dc->attr->background_mode != TRANSPARENT && (dc->attr->background_color & (1 << 24)))
|
||||
*needs_reselect = TRUE;
|
||||
|
||||
brush->dib.funcs->create_rop_masks( &brush->dib, hatches[brush->hatch],
|
||||
|
@ -1987,7 +1987,7 @@ static BOOL select_pattern_brush( dibdrv_physdev *pdev, dib_brush *brush, BOOL *
|
|||
color_table[0].rgbBlue = GetBValue( color );
|
||||
color_table[0].rgbReserved = 0;
|
||||
|
||||
color = make_rgb_colorref( dc, &pdev->dib, dc->backgroundColor, &got_pixel, &pixel );
|
||||
color = make_rgb_colorref( dc, &pdev->dib, dc->attr->background_color, &got_pixel, &pixel );
|
||||
color_table[1].rgbRed = GetRValue( color );
|
||||
color_table[1].rgbGreen = GetGValue( color );
|
||||
color_table[1].rgbBlue = GetBValue( color );
|
||||
|
|
|
@ -5694,7 +5694,7 @@ BOOL CDECL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT
|
|||
if (flags & ETO_OPAQUE)
|
||||
{
|
||||
RECT rc = *rect;
|
||||
HBRUSH brush = CreateSolidBrush( GetNearestColor( dev->hdc, dc->backgroundColor ) );
|
||||
HBRUSH brush = CreateSolidBrush( GetNearestColor( dev->hdc, dc->attr->background_color ) );
|
||||
|
||||
if (brush)
|
||||
{
|
||||
|
|
|
@ -65,6 +65,15 @@ UINT WINAPI SetTextAlign( HDC hdc, UINT align )
|
|||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetBkColor (GDI32.@)
|
||||
*/
|
||||
COLORREF WINAPI GetBkColor( HDC hdc )
|
||||
{
|
||||
DC_ATTR *dc_attr = get_dc_attr( hdc );
|
||||
return dc_attr ? dc_attr->background_color : CLR_INVALID;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetBkMode (GDI32.@)
|
||||
*/
|
||||
|
|
|
@ -119,7 +119,6 @@ typedef struct tagDC
|
|||
WORD polyFillMode;
|
||||
WORD stretchBltMode;
|
||||
WORD relAbsMode;
|
||||
COLORREF backgroundColor;
|
||||
COLORREF textColor;
|
||||
COLORREF dcBrushColor;
|
||||
COLORREF dcPenColor;
|
||||
|
|
|
@ -86,6 +86,9 @@ static void test_dc_values(void)
|
|||
ok(!attr, "attr = %x\n", attr);
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() = %u\n", GetLastError());
|
||||
|
||||
attr = GetBkColor(ULongToHandle(0xdeadbeef));
|
||||
ok(attr == CLR_INVALID, "attr = %x\n", attr);
|
||||
|
||||
DeleteDC( hdc );
|
||||
}
|
||||
|
||||
|
|
|
@ -901,7 +901,7 @@ static void test_mf_SaveDC(void)
|
|||
SetPolyFillMode( hdcMetafile, WINDING );
|
||||
SetBkColor( hdcMetafile, 0x123456 );
|
||||
todo_wine ok( !GetPolyFillMode( hdcMetafile ), "GetPolyFillMode succeeded\n" );
|
||||
todo_wine ok( GetBkColor( hdcMetafile ) == CLR_INVALID, "GetBkColor succeeded\n" );
|
||||
ok( GetBkColor( hdcMetafile ) == CLR_INVALID, "GetBkColor succeeded\n" );
|
||||
|
||||
/* Force Win9x to update DC state */
|
||||
SetPixelV(hdcMetafile, 50, 50, 0);
|
||||
|
|
|
@ -99,6 +99,7 @@ enum
|
|||
typedef struct DC_ATTR
|
||||
{
|
||||
LONG disabled; /* disabled flag, controled by DCHF_(DISABLE|ENABLE)DC */
|
||||
COLORREF background_color;
|
||||
POINT cur_pos;
|
||||
INT graphics_mode;
|
||||
DWORD layout;
|
||||
|
|
Loading…
Reference in New Issue