mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
gdi32: Recompute the background masks on every use to support PALETTEINDEX colors.
This commit is contained in:
parent
9237638c0e
commit
e166ec0bb0
@ -262,13 +262,6 @@ static void update_fg_colors( dibdrv_physdev *pdev )
|
||||
pdev->text_color = get_pixel_color( pdev, GetTextColor( pdev->dev.hdc ), TRUE );
|
||||
}
|
||||
|
||||
static void update_masks( dibdrv_physdev *pdev, INT rop )
|
||||
{
|
||||
update_brush_rop( pdev, rop );
|
||||
if( GetBkMode( pdev->dev.hdc ) == OPAQUE )
|
||||
calc_and_xor_masks( rop, pdev->bkgnd_color, &pdev->bkgnd_and, &pdev->bkgnd_xor );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* add_extra_clipping_region
|
||||
*
|
||||
@ -379,40 +372,11 @@ static COLORREF dibdrv_SetBkColor( PHYSDEV dev, COLORREF color )
|
||||
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetBkColor );
|
||||
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
|
||||
|
||||
pdev->bkgnd_color = get_pixel_color( pdev, color, FALSE );
|
||||
|
||||
if( GetBkMode(dev->hdc) == OPAQUE )
|
||||
calc_and_xor_masks( GetROP2(dev->hdc), pdev->bkgnd_color, &pdev->bkgnd_and, &pdev->bkgnd_xor );
|
||||
else
|
||||
{
|
||||
pdev->bkgnd_and = ~0u;
|
||||
pdev->bkgnd_xor = 0;
|
||||
}
|
||||
|
||||
update_fg_colors( pdev ); /* Only needed in the 1 bpp case */
|
||||
|
||||
return next->funcs->pSetBkColor( next, color );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* dibdrv_SetBkMode
|
||||
*/
|
||||
static INT dibdrv_SetBkMode( PHYSDEV dev, INT mode )
|
||||
{
|
||||
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetBkMode );
|
||||
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
|
||||
|
||||
if( mode == OPAQUE )
|
||||
calc_and_xor_masks( GetROP2(dev->hdc), pdev->bkgnd_color, &pdev->bkgnd_and, &pdev->bkgnd_xor );
|
||||
else
|
||||
{
|
||||
pdev->bkgnd_and = ~0u;
|
||||
pdev->bkgnd_xor = 0;
|
||||
}
|
||||
|
||||
return next->funcs->pSetBkMode( next, mode );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* dibdrv_SetDeviceClipping
|
||||
*/
|
||||
@ -438,10 +402,8 @@ static UINT dibdrv_SetDIBColorTable( PHYSDEV dev, UINT pos, UINT count, const RG
|
||||
|
||||
if (pdev->dib.color_table)
|
||||
{
|
||||
pdev->bkgnd_color = get_pixel_color( pdev, GetBkColor( dev->hdc ), FALSE );
|
||||
update_fg_colors( pdev );
|
||||
|
||||
update_masks( pdev, GetROP2( dev->hdc ) );
|
||||
update_brush_rop( pdev, GetROP2( dev->hdc ) );
|
||||
}
|
||||
return next->funcs->pSetDIBColorTable( next, pos, count, colors );
|
||||
}
|
||||
@ -454,7 +416,7 @@ static INT dibdrv_SetROP2( PHYSDEV dev, INT rop )
|
||||
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetROP2 );
|
||||
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
|
||||
|
||||
update_masks( pdev, rop );
|
||||
update_brush_rop( pdev, rop );
|
||||
|
||||
return next->funcs->pSetROP2( next, rop );
|
||||
}
|
||||
@ -575,7 +537,7 @@ const struct gdi_dc_funcs dib_driver =
|
||||
dibdrv_SelectPen, /* pSelectPen */
|
||||
NULL, /* pSetArcDirection */
|
||||
dibdrv_SetBkColor, /* pSetBkColor */
|
||||
dibdrv_SetBkMode, /* pSetBkMode */
|
||||
NULL, /* pSetBkMode */
|
||||
dibdrv_SetDCBrushColor, /* pSetDCBrushColor */
|
||||
dibdrv_SetDCPenColor, /* pSetDCPenColor */
|
||||
dibdrv_SetDIBColorTable, /* pSetDIBColorTable */
|
||||
|
@ -103,9 +103,6 @@ typedef struct dibdrv_physdev
|
||||
HBITMAP brush_pattern_bitmap;
|
||||
BOOL (* brush_rects)(struct dibdrv_physdev *pdev, dib_info *dib, int num, const RECT *rects, HRGN clip);
|
||||
|
||||
/* background */
|
||||
DWORD bkgnd_color, bkgnd_and, bkgnd_xor;
|
||||
|
||||
/* text */
|
||||
DWORD text_color;
|
||||
struct intensity_range glyph_intensities[17];
|
||||
|
@ -114,16 +114,18 @@ void update_aa_ranges( dibdrv_physdev *pdev )
|
||||
*
|
||||
* See the comment above get_pen_bkgnd_masks
|
||||
*/
|
||||
static inline void get_text_bkgnd_masks( const dibdrv_physdev *pdev, rop_mask *mask )
|
||||
static inline void get_text_bkgnd_masks( dibdrv_physdev *pdev, rop_mask *mask )
|
||||
{
|
||||
COLORREF bg = GetBkColor( pdev->dev.hdc );
|
||||
|
||||
mask->and = 0;
|
||||
|
||||
if (pdev->dib.bit_count != 1)
|
||||
mask->xor = pdev->bkgnd_color;
|
||||
mask->xor = get_pixel_color( pdev, bg, FALSE );
|
||||
else
|
||||
{
|
||||
mask->xor = ~pdev->text_color;
|
||||
if (GetTextColor( pdev->dev.hdc ) == GetBkColor( pdev->dev.hdc ))
|
||||
if (GetTextColor( pdev->dev.hdc ) == bg)
|
||||
mask->xor = pdev->text_color;
|
||||
}
|
||||
}
|
||||
|
@ -180,8 +180,9 @@ DWORD get_pixel_color( dibdrv_physdev *pdev, COLORREF color, BOOL mono_fixup )
|
||||
if(rgbquad_equal(&fg_quad, pdev->dib.color_table + 1))
|
||||
return 1;
|
||||
|
||||
if(color == GetBkColor(pdev->dev.hdc)) return pdev->bkgnd_color;
|
||||
else return pdev->bkgnd_color ? 0 : 1;
|
||||
pixel = get_pixel_color( pdev, GetBkColor(pdev->dev.hdc), FALSE );
|
||||
if (color == GetBkColor(pdev->dev.hdc)) return pixel;
|
||||
else return !pixel;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -194,17 +195,25 @@ DWORD get_pixel_color( dibdrv_physdev *pdev, COLORREF color, BOOL mono_fixup )
|
||||
*/
|
||||
static inline void get_pen_bkgnd_masks(dibdrv_physdev *pdev, DWORD *and, DWORD *xor)
|
||||
{
|
||||
if(pdev->dib.bit_count != 1 || GetBkMode(pdev->dev.hdc) == TRANSPARENT)
|
||||
DWORD color;
|
||||
|
||||
if (GetBkMode(pdev->dev.hdc) == TRANSPARENT)
|
||||
{
|
||||
*and = pdev->bkgnd_and;
|
||||
*xor = pdev->bkgnd_xor;
|
||||
*and = ~0u;
|
||||
*xor = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (pdev->dib.bit_count != 1)
|
||||
{
|
||||
color = get_pixel_color( pdev, GetBkColor(pdev->dev.hdc), FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD color = get_pixel_color( pdev, pdev->pen_colorref, TRUE );
|
||||
color = get_pixel_color( pdev, pdev->pen_colorref, TRUE );
|
||||
if(pdev->pen_colorref != GetBkColor(pdev->dev.hdc)) color = !color;
|
||||
calc_and_xor_masks( GetROP2(pdev->dev.hdc), color, and, xor );
|
||||
}
|
||||
calc_and_xor_masks( GetROP2(pdev->dev.hdc), color, and, xor );
|
||||
}
|
||||
|
||||
static inline void get_brush_bkgnd_masks(dibdrv_physdev *pdev, DWORD *and, DWORD *xor)
|
||||
@ -213,8 +222,8 @@ static inline void get_brush_bkgnd_masks(dibdrv_physdev *pdev, DWORD *and, DWORD
|
||||
|
||||
if(GetBkMode(pdev->dev.hdc) == TRANSPARENT)
|
||||
{
|
||||
*and = pdev->bkgnd_and;
|
||||
*xor = pdev->bkgnd_xor;
|
||||
*and = ~0u;
|
||||
*xor = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user