gdi32: Recompute the foreground masks on every use to support PALETTEINDEX colors.
This commit is contained in:
parent
e166ec0bb0
commit
56532d0cf7
|
@ -257,11 +257,6 @@ DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bit
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void update_fg_colors( dibdrv_physdev *pdev )
|
|
||||||
{
|
|
||||||
pdev->text_color = get_pixel_color( pdev, GetTextColor( pdev->dev.hdc ), TRUE );
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* add_extra_clipping_region
|
* add_extra_clipping_region
|
||||||
*
|
*
|
||||||
|
@ -364,19 +359,6 @@ static HBITMAP dibdrv_SelectBitmap( PHYSDEV dev, HBITMAP bitmap )
|
||||||
return next->funcs->pSelectBitmap( next, bitmap );
|
return next->funcs->pSelectBitmap( next, bitmap );
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* dibdrv_SetBkColor
|
|
||||||
*/
|
|
||||||
static COLORREF dibdrv_SetBkColor( PHYSDEV dev, COLORREF color )
|
|
||||||
{
|
|
||||||
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetBkColor );
|
|
||||||
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
|
|
||||||
|
|
||||||
update_fg_colors( pdev ); /* Only needed in the 1 bpp case */
|
|
||||||
|
|
||||||
return next->funcs->pSetBkColor( next, color );
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* dibdrv_SetDeviceClipping
|
* dibdrv_SetDeviceClipping
|
||||||
*/
|
*/
|
||||||
|
@ -400,11 +382,8 @@ static UINT dibdrv_SetDIBColorTable( PHYSDEV dev, UINT pos, UINT count, const RG
|
||||||
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
|
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
|
||||||
TRACE("(%p, %d, %d, %p)\n", dev, pos, count, colors);
|
TRACE("(%p, %d, %d, %p)\n", dev, pos, count, colors);
|
||||||
|
|
||||||
if (pdev->dib.color_table)
|
if (pdev->dib.color_table) update_brush_rop( pdev, GetROP2( dev->hdc ) );
|
||||||
{
|
|
||||||
update_fg_colors( pdev );
|
|
||||||
update_brush_rop( pdev, GetROP2( dev->hdc ) );
|
|
||||||
}
|
|
||||||
return next->funcs->pSetDIBColorTable( next, pos, count, colors );
|
return next->funcs->pSetDIBColorTable( next, pos, count, colors );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,19 +400,6 @@ static INT dibdrv_SetROP2( PHYSDEV dev, INT rop )
|
||||||
return next->funcs->pSetROP2( next, rop );
|
return next->funcs->pSetROP2( next, rop );
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* dibdrv_SetTextColor
|
|
||||||
*/
|
|
||||||
static COLORREF dibdrv_SetTextColor( PHYSDEV dev, COLORREF color )
|
|
||||||
{
|
|
||||||
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetTextColor );
|
|
||||||
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
|
|
||||||
|
|
||||||
pdev->text_color = get_pixel_color( pdev, color, TRUE );
|
|
||||||
update_aa_ranges( pdev );
|
|
||||||
|
|
||||||
return next->funcs->pSetTextColor( next, color );
|
|
||||||
}
|
|
||||||
|
|
||||||
const struct gdi_dc_funcs dib_driver =
|
const struct gdi_dc_funcs dib_driver =
|
||||||
{
|
{
|
||||||
|
@ -536,7 +502,7 @@ const struct gdi_dc_funcs dib_driver =
|
||||||
NULL, /* pSelectPalette */
|
NULL, /* pSelectPalette */
|
||||||
dibdrv_SelectPen, /* pSelectPen */
|
dibdrv_SelectPen, /* pSelectPen */
|
||||||
NULL, /* pSetArcDirection */
|
NULL, /* pSetArcDirection */
|
||||||
dibdrv_SetBkColor, /* pSetBkColor */
|
NULL, /* pSetBkColor */
|
||||||
NULL, /* pSetBkMode */
|
NULL, /* pSetBkMode */
|
||||||
dibdrv_SetDCBrushColor, /* pSetDCBrushColor */
|
dibdrv_SetDCBrushColor, /* pSetDCBrushColor */
|
||||||
dibdrv_SetDCPenColor, /* pSetDCPenColor */
|
dibdrv_SetDCPenColor, /* pSetDCPenColor */
|
||||||
|
@ -555,7 +521,7 @@ const struct gdi_dc_funcs dib_driver =
|
||||||
NULL, /* pSetStretchBltMode */
|
NULL, /* pSetStretchBltMode */
|
||||||
NULL, /* pSetTextAlign */
|
NULL, /* pSetTextAlign */
|
||||||
NULL, /* pSetTextCharacterExtra */
|
NULL, /* pSetTextCharacterExtra */
|
||||||
dibdrv_SetTextColor, /* pSetTextColor */
|
NULL, /* pSetTextColor */
|
||||||
NULL, /* pSetTextJustification */
|
NULL, /* pSetTextJustification */
|
||||||
NULL, /* pSetViewportExt */
|
NULL, /* pSetViewportExt */
|
||||||
NULL, /* pSetViewportOrg */
|
NULL, /* pSetViewportOrg */
|
||||||
|
|
|
@ -102,10 +102,6 @@ typedef struct dibdrv_physdev
|
||||||
UINT brush_pattern_usage;
|
UINT brush_pattern_usage;
|
||||||
HBITMAP brush_pattern_bitmap;
|
HBITMAP brush_pattern_bitmap;
|
||||||
BOOL (* brush_rects)(struct dibdrv_physdev *pdev, dib_info *dib, int num, const RECT *rects, HRGN clip);
|
BOOL (* brush_rects)(struct dibdrv_physdev *pdev, dib_info *dib, int num, const RECT *rects, HRGN clip);
|
||||||
|
|
||||||
/* text */
|
|
||||||
DWORD text_color;
|
|
||||||
struct intensity_range glyph_intensities[17];
|
|
||||||
} dibdrv_physdev;
|
} dibdrv_physdev;
|
||||||
|
|
||||||
#define DEFER_PEN 2
|
#define DEFER_PEN 2
|
||||||
|
@ -234,7 +230,6 @@ extern HRGN add_extra_clipping_region( dibdrv_physdev *pdev, HRGN rgn ) DECLSPEC
|
||||||
extern void restore_clipping_region( dibdrv_physdev *pdev, HRGN rgn ) DECLSPEC_HIDDEN;
|
extern void restore_clipping_region( dibdrv_physdev *pdev, HRGN rgn ) DECLSPEC_HIDDEN;
|
||||||
extern int clip_line(const POINT *start, const POINT *end, const RECT *clip,
|
extern int clip_line(const POINT *start, const POINT *end, const RECT *clip,
|
||||||
const bres_params *params, POINT *pt1, POINT *pt2) DECLSPEC_HIDDEN;
|
const bres_params *params, POINT *pt1, POINT *pt2) DECLSPEC_HIDDEN;
|
||||||
extern void update_aa_ranges( dibdrv_physdev *pdev ) DECLSPEC_HIDDEN;
|
|
||||||
|
|
||||||
/* compute the x coordinate corresponding to y on the specified edge */
|
/* compute the x coordinate corresponding to y on the specified edge */
|
||||||
static inline int edge_coord( int y, int x1, int y1, int x2, int y2 )
|
static inline int edge_coord( int y, int x1, int y1, int x2, int y2 )
|
||||||
|
|
|
@ -103,12 +103,6 @@ static inline void get_aa_ranges( COLORREF col, struct intensity_range intensiti
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_aa_ranges( dibdrv_physdev *pdev )
|
|
||||||
{
|
|
||||||
COLORREF text = pdev->dib.funcs->pixel_to_colorref( &pdev->dib, pdev->text_color );
|
|
||||||
get_aa_ranges( text, pdev->glyph_intensities );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* get_text_bkgnd_masks
|
* get_text_bkgnd_masks
|
||||||
*
|
*
|
||||||
|
@ -124,14 +118,15 @@ static inline void get_text_bkgnd_masks( dibdrv_physdev *pdev, rop_mask *mask )
|
||||||
mask->xor = get_pixel_color( pdev, bg, FALSE );
|
mask->xor = get_pixel_color( pdev, bg, FALSE );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mask->xor = ~pdev->text_color;
|
COLORREF fg = GetTextColor( pdev->dev.hdc );
|
||||||
if (GetTextColor( pdev->dev.hdc ) == bg)
|
mask->xor = get_pixel_color( pdev, fg, TRUE );
|
||||||
mask->xor = pdev->text_color;
|
if (fg != bg) mask->xor = ~mask->xor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void draw_glyph( dibdrv_physdev *pdev, const POINT *origin, const GLYPHMETRICS *metrics,
|
static void draw_glyph( dibdrv_physdev *pdev, const POINT *origin, const GLYPHMETRICS *metrics,
|
||||||
const struct gdi_image_bits *image )
|
const struct gdi_image_bits *image, DWORD text_color,
|
||||||
|
const struct intensity_range *ranges )
|
||||||
{
|
{
|
||||||
const WINEREGION *clip = get_wine_region( pdev->clip );
|
const WINEREGION *clip = get_wine_region( pdev->clip );
|
||||||
int i;
|
int i;
|
||||||
|
@ -158,7 +153,7 @@ static void draw_glyph( dibdrv_physdev *pdev, const POINT *origin, const GLYPHME
|
||||||
src_origin.y = clipped_rect.top - rect.top;
|
src_origin.y = clipped_rect.top - rect.top;
|
||||||
|
|
||||||
pdev->dib.funcs->draw_glyph( &pdev->dib, &clipped_rect, &glyph_dib, &src_origin,
|
pdev->dib.funcs->draw_glyph( &pdev->dib, &clipped_rect, &glyph_dib, &src_origin,
|
||||||
pdev->text_color, pdev->glyph_intensities );
|
text_color, ranges );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,8 +334,9 @@ BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
|
||||||
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
|
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
|
||||||
UINT aa_flags, i;
|
UINT aa_flags, i;
|
||||||
POINT origin;
|
POINT origin;
|
||||||
DWORD err;
|
DWORD text_color, err;
|
||||||
HRGN saved_clip = NULL;
|
HRGN saved_clip = NULL;
|
||||||
|
struct intensity_range ranges[17];
|
||||||
|
|
||||||
if (flags & ETO_OPAQUE)
|
if (flags & ETO_OPAQUE)
|
||||||
{
|
{
|
||||||
|
@ -358,6 +354,9 @@ BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
|
||||||
DeleteObject( clip );
|
DeleteObject( clip );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
text_color = get_pixel_color( pdev, GetTextColor( pdev->dev.hdc ), TRUE );
|
||||||
|
get_aa_ranges( pdev->dib.funcs->pixel_to_colorref( &pdev->dib, text_color ), ranges );
|
||||||
|
|
||||||
aa_flags = get_font_aa_flags( dev->hdc );
|
aa_flags = get_font_aa_flags( dev->hdc );
|
||||||
origin.x = x;
|
origin.x = x;
|
||||||
origin.y = y;
|
origin.y = y;
|
||||||
|
@ -369,7 +368,7 @@ BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
|
||||||
err = get_glyph_bitmap( dev->hdc, (UINT)str[i], aa_flags, &metrics, &image );
|
err = get_glyph_bitmap( dev->hdc, (UINT)str[i], aa_flags, &metrics, &image );
|
||||||
if (err) continue;
|
if (err) continue;
|
||||||
|
|
||||||
if (image.ptr) draw_glyph( pdev, &origin, &metrics, &image );
|
if (image.ptr) draw_glyph( pdev, &origin, &metrics, &image, text_color, ranges );
|
||||||
if (image.free) image.free( &image );
|
if (image.free) image.free( &image );
|
||||||
|
|
||||||
if (dx)
|
if (dx)
|
||||||
|
|
Loading…
Reference in New Issue