Commit d8e353f9 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

gdi32: Pass a DC pointer to get_pixel_color().

parent cf386b8b
...@@ -250,7 +250,7 @@ extern void free_dib_info(dib_info *dib) DECLSPEC_HIDDEN; ...@@ -250,7 +250,7 @@ extern void free_dib_info(dib_info *dib) DECLSPEC_HIDDEN;
extern void free_pattern_brush(dib_brush *brush) DECLSPEC_HIDDEN; extern void free_pattern_brush(dib_brush *brush) DECLSPEC_HIDDEN;
extern void copy_dib_color_info(dib_info *dst, const dib_info *src) DECLSPEC_HIDDEN; extern void copy_dib_color_info(dib_info *dst, const dib_info *src) DECLSPEC_HIDDEN;
extern BOOL convert_dib(dib_info *dst, const dib_info *src) DECLSPEC_HIDDEN; extern BOOL convert_dib(dib_info *dst, const dib_info *src) DECLSPEC_HIDDEN;
extern DWORD get_pixel_color( HDC hdc, const dib_info *dib, COLORREF color, BOOL mono_fixup ) DECLSPEC_HIDDEN; extern DWORD get_pixel_color( DC *dc, const dib_info *dib, COLORREF color, BOOL mono_fixup ) DECLSPEC_HIDDEN;
extern int clip_rect_to_dib( const dib_info *dib, RECT *rc ) DECLSPEC_HIDDEN; extern int clip_rect_to_dib( const dib_info *dib, RECT *rc ) DECLSPEC_HIDDEN;
extern int get_clipped_rects( const dib_info *dib, const RECT *rc, HRGN clip, struct clipped_rects *clip_rects ) DECLSPEC_HIDDEN; extern int get_clipped_rects( const dib_info *dib, const RECT *rc, HRGN clip, struct clipped_rects *clip_rects ) DECLSPEC_HIDDEN;
extern void add_clipped_bounds( dibdrv_physdev *dev, const RECT *rect, HRGN clip ) DECLSPEC_HIDDEN; extern void add_clipped_bounds( dibdrv_physdev *dev, const RECT *rect, HRGN clip ) DECLSPEC_HIDDEN;
......
...@@ -550,15 +550,15 @@ static int font_cache_cmp( const struct cached_font *p1, const struct cached_fon ...@@ -550,15 +550,15 @@ static int font_cache_cmp( const struct cached_font *p1, const struct cached_fon
return ret; return ret;
} }
static struct cached_font *add_cached_font( HDC hdc, HFONT hfont, UINT aa_flags ) static struct cached_font *add_cached_font( DC *dc, HFONT hfont, UINT aa_flags )
{ {
struct cached_font font, *ptr, *last_unused = NULL; struct cached_font font, *ptr, *last_unused = NULL;
UINT i = 0, j, k; UINT i = 0, j, k;
GetObjectW( hfont, sizeof(font.lf), &font.lf ); GetObjectW( hfont, sizeof(font.lf), &font.lf );
GetTransform( hdc, 0x204, &font.xform ); font.xform = dc->xformWorld2Vport;
font.xform.eDx = font.xform.eDy = 0; /* unused, would break hashing */ font.xform.eDx = font.xform.eDy = 0; /* unused, would break hashing */
if (GetGraphicsMode( hdc ) == GM_COMPATIBLE) if (dc->GraphicsMode == GM_COMPATIBLE)
{ {
font.lf.lfOrientation = font.lf.lfEscapement; font.lf.lfOrientation = font.lf.lfEscapement;
if (font.xform.eM11 * font.xform.eM22 < 0) if (font.xform.eM11 * font.xform.eM22 < 0)
...@@ -661,18 +661,18 @@ static struct cached_glyph *get_cached_glyph( struct cached_font *font, UINT ind ...@@ -661,18 +661,18 @@ static struct cached_glyph *get_cached_glyph( struct cached_font *font, UINT ind
* *
* See the comment above get_pen_bkgnd_masks * See the comment above get_pen_bkgnd_masks
*/ */
static inline void get_text_bkgnd_masks( HDC hdc, const dib_info *dib, rop_mask *mask ) static inline void get_text_bkgnd_masks( DC *dc, const dib_info *dib, rop_mask *mask )
{ {
COLORREF bg = GetBkColor( hdc ); COLORREF bg = dc->backgroundColor;
mask->and = 0; mask->and = 0;
if (dib->bit_count != 1) if (dib->bit_count != 1)
mask->xor = get_pixel_color( hdc, dib, bg, FALSE ); mask->xor = get_pixel_color( dc, dib, bg, FALSE );
else else
{ {
COLORREF fg = GetTextColor( hdc ); COLORREF fg = dc->textColor;
mask->xor = get_pixel_color( hdc, dib, fg, TRUE ); mask->xor = get_pixel_color( dc, dib, fg, TRUE );
if (fg != bg) mask->xor = ~mask->xor; if (fg != bg) mask->xor = ~mask->xor;
} }
} }
...@@ -741,7 +741,7 @@ static const int padding[4] = {0, 3, 2, 1}; ...@@ -741,7 +741,7 @@ static const int padding[4] = {0, 3, 2, 1};
* For non-antialiased bitmaps convert them to the 17-level format * For non-antialiased bitmaps convert them to the 17-level format
* using only values 0 or 16. * using only values 0 or 16.
*/ */
static struct cached_glyph *cache_glyph_bitmap( HDC hdc, struct cached_font *font, UINT index, UINT flags ) static struct cached_glyph *cache_glyph_bitmap( DC *dc, struct cached_font *font, UINT index, UINT flags )
{ {
UINT ggo_flags = font->aa_flags; UINT ggo_flags = font->aa_flags;
static const MAT2 identity = { {0,1}, {0,0}, {0,0}, {0,1} }; static const MAT2 identity = { {0,1}, {0,0}, {0,0}, {0,1} };
...@@ -758,7 +758,7 @@ static struct cached_glyph *cache_glyph_bitmap( HDC hdc, struct cached_font *fon ...@@ -758,7 +758,7 @@ static struct cached_glyph *cache_glyph_bitmap( HDC hdc, struct cached_font *fon
for (i = 0; i < sizeof(indices) / sizeof(indices[0]); i++) for (i = 0; i < sizeof(indices) / sizeof(indices[0]); i++)
{ {
index = indices[i]; index = indices[i];
ret = GetGlyphOutlineW( hdc, index, ggo_flags, &metrics, 0, NULL, &identity ); ret = GetGlyphOutlineW( dc->hSelf, index, ggo_flags, &metrics, 0, NULL, &identity );
if (ret != GDI_ERROR) break; if (ret != GDI_ERROR) break;
} }
if (ret == GDI_ERROR) return NULL; if (ret == GDI_ERROR) return NULL;
...@@ -773,7 +773,7 @@ static struct cached_glyph *cache_glyph_bitmap( HDC hdc, struct cached_font *fon ...@@ -773,7 +773,7 @@ static struct cached_glyph *cache_glyph_bitmap( HDC hdc, struct cached_font *fon
if (bit_count == 8) pad = padding[ metrics.gmBlackBoxX % 4 ]; if (bit_count == 8) pad = padding[ metrics.gmBlackBoxX % 4 ];
ret = GetGlyphOutlineW( hdc, index, ggo_flags, &metrics, size, glyph->bits, &identity ); ret = GetGlyphOutlineW( dc->hSelf, index, ggo_flags, &metrics, size, glyph->bits, &identity );
if (ret == GDI_ERROR) if (ret == GDI_ERROR)
{ {
HeapFree( GetProcessHeap(), 0, glyph ); HeapFree( GetProcessHeap(), 0, glyph );
...@@ -804,7 +804,7 @@ done: ...@@ -804,7 +804,7 @@ done:
return add_cached_glyph( font, index, flags, glyph ); return add_cached_glyph( font, index, flags, glyph );
} }
static void render_string( HDC hdc, dib_info *dib, struct cached_font *font, INT x, INT y, static void render_string( DC *dc, dib_info *dib, struct cached_font *font, INT x, INT y,
UINT flags, const WCHAR *str, UINT count, const INT *dx, UINT flags, const WCHAR *str, UINT count, const INT *dx,
const struct clipped_rects *clipped_rects, RECT *bounds ) const struct clipped_rects *clipped_rects, RECT *bounds )
{ {
...@@ -820,7 +820,7 @@ static void render_string( HDC hdc, dib_info *dib, struct cached_font *font, INT ...@@ -820,7 +820,7 @@ static void render_string( HDC hdc, dib_info *dib, struct cached_font *font, INT
glyph_dib.bits.is_copy = FALSE; glyph_dib.bits.is_copy = FALSE;
glyph_dib.bits.free = NULL; glyph_dib.bits.free = NULL;
text_color = get_pixel_color( hdc, dib, GetTextColor( hdc ), TRUE ); text_color = get_pixel_color( dc, dib, dc->textColor, TRUE );
if (glyph_dib.bit_count == 8) if (glyph_dib.bit_count == 8)
get_aa_ranges( dib->funcs->pixel_to_colorref( dib, text_color ), ranges ); get_aa_ranges( dib->funcs->pixel_to_colorref( dib, text_color ), ranges );
...@@ -828,7 +828,7 @@ static void render_string( HDC hdc, dib_info *dib, struct cached_font *font, INT ...@@ -828,7 +828,7 @@ static void render_string( HDC hdc, dib_info *dib, struct cached_font *font, INT
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
if (!(glyph = get_cached_glyph( font, str[i], flags )) && if (!(glyph = get_cached_glyph( font, str[i], flags )) &&
!(glyph = cache_glyph_bitmap( hdc, font, str[i], flags ))) continue; !(glyph = cache_glyph_bitmap( dc, font, str[i], flags ))) continue;
glyph_dib.width = glyph->metrics.gmBlackBoxX; glyph_dib.width = glyph->metrics.gmBlackBoxX;
glyph_dib.height = glyph->metrics.gmBlackBoxY; glyph_dib.height = glyph->metrics.gmBlackBoxY;
...@@ -857,7 +857,7 @@ static void render_string( HDC hdc, dib_info *dib, struct cached_font *font, INT ...@@ -857,7 +857,7 @@ static void render_string( HDC hdc, dib_info *dib, struct cached_font *font, INT
} }
} }
BOOL render_aa_text_bitmapinfo( HDC hdc, BITMAPINFO *info, struct gdi_image_bits *bits, BOOL render_aa_text_bitmapinfo( DC *dc, BITMAPINFO *info, struct gdi_image_bits *bits,
struct bitblt_coords *src, INT x, INT y, UINT flags, struct bitblt_coords *src, INT x, INT y, UINT flags,
UINT aa_flags, LPCWSTR str, UINT count, const INT *dx ) UINT aa_flags, LPCWSTR str, UINT count, const INT *dx )
{ {
...@@ -875,13 +875,13 @@ BOOL render_aa_text_bitmapinfo( HDC hdc, BITMAPINFO *info, struct gdi_image_bits ...@@ -875,13 +875,13 @@ BOOL render_aa_text_bitmapinfo( HDC hdc, BITMAPINFO *info, struct gdi_image_bits
if (flags & ETO_OPAQUE) if (flags & ETO_OPAQUE)
{ {
rop_mask bkgnd_color; rop_mask bkgnd_color;
get_text_bkgnd_masks( hdc, &dib, &bkgnd_color ); get_text_bkgnd_masks( dc, &dib, &bkgnd_color );
dib.funcs->solid_rects( &dib, 1, &src->visrect, bkgnd_color.and, bkgnd_color.xor ); dib.funcs->solid_rects( &dib, 1, &src->visrect, bkgnd_color.and, bkgnd_color.xor );
} }
if (!(font = add_cached_font( hdc, GetCurrentObject( hdc, OBJ_FONT ), aa_flags ))) return FALSE; if (!(font = add_cached_font( dc, dc->hFont, aa_flags ))) return FALSE;
render_string( hdc, &dib, font, x, y, flags, str, count, dx, &visrect, NULL ); render_string( dc, &dib, font, x, y, flags, str, count, dx, &visrect, NULL );
release_cached_font( font ); release_cached_font( font );
return TRUE; return TRUE;
} }
...@@ -893,6 +893,7 @@ BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, ...@@ -893,6 +893,7 @@ BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
const RECT *rect, LPCWSTR str, UINT count, const INT *dx ) const RECT *rect, LPCWSTR str, UINT count, const INT *dx )
{ {
dibdrv_physdev *pdev = get_dibdrv_pdev(dev); dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
DC *dc = get_physdev_dc( dev );
struct clipped_rects clipped_rects; struct clipped_rects clipped_rects;
RECT bounds; RECT bounds;
...@@ -904,7 +905,7 @@ BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, ...@@ -904,7 +905,7 @@ BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
if (flags & ETO_OPAQUE) if (flags & ETO_OPAQUE)
{ {
rop_mask bkgnd_color; rop_mask bkgnd_color;
get_text_bkgnd_masks( dev->hdc, &pdev->dib, &bkgnd_color ); get_text_bkgnd_masks( dc, &pdev->dib, &bkgnd_color );
add_bounds_rect( &bounds, rect ); add_bounds_rect( &bounds, rect );
get_clipped_rects( &pdev->dib, rect, pdev->clip, &clipped_rects ); get_clipped_rects( &pdev->dib, rect, pdev->clip, &clipped_rects );
pdev->dib.funcs->solid_rects( &pdev->dib, clipped_rects.count, clipped_rects.rects, pdev->dib.funcs->solid_rects( &pdev->dib, clipped_rects.count, clipped_rects.rects,
...@@ -925,7 +926,7 @@ BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, ...@@ -925,7 +926,7 @@ BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
} }
if (!clipped_rects.count) goto done; if (!clipped_rects.count) goto done;
render_string( dev->hdc, &pdev->dib, pdev->font, x, y, flags, str, count, dx, render_string( dc, &pdev->dib, pdev->font, x, y, flags, str, count, dx,
&clipped_rects, &bounds ); &clipped_rects, &bounds );
done: done:
...@@ -940,6 +941,7 @@ done: ...@@ -940,6 +941,7 @@ done:
HFONT dibdrv_SelectFont( PHYSDEV dev, HFONT font, UINT *aa_flags ) HFONT dibdrv_SelectFont( PHYSDEV dev, HFONT font, UINT *aa_flags )
{ {
dibdrv_physdev *pdev = get_dibdrv_pdev(dev); dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
DC *dc = get_physdev_dc( dev );
HFONT ret; HFONT ret;
if (pdev->dib.bit_count <= 8) *aa_flags = GGO_BITMAP; /* no anti-aliasing on <= 8bpp */ if (pdev->dib.bit_count <= 8) *aa_flags = GGO_BITMAP; /* no anti-aliasing on <= 8bpp */
...@@ -949,7 +951,7 @@ HFONT dibdrv_SelectFont( PHYSDEV dev, HFONT font, UINT *aa_flags ) ...@@ -949,7 +951,7 @@ HFONT dibdrv_SelectFont( PHYSDEV dev, HFONT font, UINT *aa_flags )
if (ret) if (ret)
{ {
struct cached_font *prev = pdev->font; struct cached_font *prev = pdev->font;
pdev->font = add_cached_font( dev->hdc, font, *aa_flags ? *aa_flags : GGO_BITMAP ); pdev->font = add_cached_font( dc, font, *aa_flags ? *aa_flags : GGO_BITMAP );
release_cached_font( prev ); release_cached_font( prev );
} }
return ret; return ret;
...@@ -1044,7 +1046,8 @@ static void fill_row( dib_info *dib, HRGN clip, RECT *row, DWORD pixel, UINT typ ...@@ -1044,7 +1046,8 @@ static void fill_row( dib_info *dib, HRGN clip, RECT *row, DWORD pixel, UINT typ
BOOL dibdrv_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT type ) BOOL dibdrv_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT type )
{ {
dibdrv_physdev *pdev = get_dibdrv_pdev( dev ); dibdrv_physdev *pdev = get_dibdrv_pdev( dev );
DWORD pixel = get_pixel_color( dev->hdc, &pdev->dib, color, FALSE ); DC *dc = get_physdev_dc( dev );
DWORD pixel = get_pixel_color( dc, &pdev->dib, color, FALSE );
RECT row; RECT row;
HRGN rgn; HRGN rgn;
...@@ -1083,11 +1086,12 @@ BOOL dibdrv_FillPath( PHYSDEV dev ) ...@@ -1083,11 +1086,12 @@ BOOL dibdrv_FillPath( PHYSDEV dev )
COLORREF dibdrv_GetNearestColor( PHYSDEV dev, COLORREF color ) COLORREF dibdrv_GetNearestColor( PHYSDEV dev, COLORREF color )
{ {
dibdrv_physdev *pdev = get_dibdrv_pdev( dev ); dibdrv_physdev *pdev = get_dibdrv_pdev( dev );
DC *dc = get_physdev_dc( dev );
DWORD pixel; DWORD pixel;
TRACE( "(%p, %08x)\n", dev, color ); TRACE( "(%p, %08x)\n", dev, color );
pixel = get_pixel_color( dev->hdc, &pdev->dib, color, FALSE ); pixel = get_pixel_color( dc, &pdev->dib, color, FALSE );
return pdev->dib.funcs->pixel_to_colorref( &pdev->dib, pixel ); return pdev->dib.funcs->pixel_to_colorref( &pdev->dib, pixel );
} }
...@@ -1577,7 +1581,7 @@ COLORREF dibdrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) ...@@ -1577,7 +1581,7 @@ COLORREF dibdrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
add_clipped_bounds( pdev, &rect, pdev->clip ); add_clipped_bounds( pdev, &rect, pdev->clip );
/* SetPixel doesn't do the 1bpp massaging like other fg colors */ /* SetPixel doesn't do the 1bpp massaging like other fg colors */
pixel = get_pixel_color( dev->hdc, &pdev->dib, color, FALSE ); pixel = get_pixel_color( dc, &pdev->dib, color, FALSE );
color = pdev->dib.funcs->pixel_to_colorref( &pdev->dib, pixel ); color = pdev->dib.funcs->pixel_to_colorref( &pdev->dib, pixel );
if (!get_clipped_rects( &pdev->dib, &rect, pdev->clip, &clipped_rects )) return color; if (!get_clipped_rects( &pdev->dib, &rect, pdev->clip, &clipped_rects )) return color;
......
...@@ -135,18 +135,18 @@ static inline BOOL rgbquad_equal(const RGBQUAD *a, const RGBQUAD *b) ...@@ -135,18 +135,18 @@ static inline BOOL rgbquad_equal(const RGBQUAD *a, const RGBQUAD *b)
return FALSE; return FALSE;
} }
static COLORREF make_rgb_colorref( HDC hdc, const dib_info *dib, COLORREF color, BOOL *got_pixel, DWORD *pixel ) static COLORREF make_rgb_colorref( DC *dc, const dib_info *dib, COLORREF color,
BOOL *got_pixel, DWORD *pixel )
{ {
*pixel = 0; *pixel = 0;
*got_pixel = FALSE; *got_pixel = FALSE;
if (color & (1 << 24)) /* PALETTEINDEX */ if (color & (1 << 24)) /* PALETTEINDEX */
{ {
HPALETTE pal = GetCurrentObject( hdc, OBJ_PAL );
PALETTEENTRY pal_ent; PALETTEENTRY pal_ent;
if (!GetPaletteEntries( pal, LOWORD(color), 1, &pal_ent )) if (!GetPaletteEntries( dc->hPalette, LOWORD(color), 1, &pal_ent ))
GetPaletteEntries( pal, 0, 1, &pal_ent ); GetPaletteEntries( dc->hPalette, 0, 1, &pal_ent );
return RGB( pal_ent.peRed, pal_ent.peGreen, pal_ent.peBlue ); return RGB( pal_ent.peRed, pal_ent.peGreen, pal_ent.peBlue );
} }
...@@ -172,7 +172,7 @@ static COLORREF make_rgb_colorref( HDC hdc, const dib_info *dib, COLORREF color, ...@@ -172,7 +172,7 @@ static COLORREF make_rgb_colorref( HDC hdc, const dib_info *dib, COLORREF color,
* Otherwise the bg color is mapped to the closest entry in the table and * Otherwise the bg color is mapped to the closest entry in the table and
* the fg takes the other one. * the fg takes the other one.
*/ */
DWORD get_pixel_color( HDC hdc, const dib_info *dib, COLORREF color, BOOL mono_fixup ) DWORD get_pixel_color( DC *dc, const dib_info *dib, COLORREF color, BOOL mono_fixup )
{ {
RGBQUAD fg_quad; RGBQUAD fg_quad;
BOOL got_pixel; BOOL got_pixel;
...@@ -180,7 +180,7 @@ DWORD get_pixel_color( HDC hdc, const dib_info *dib, COLORREF color, BOOL mono_f ...@@ -180,7 +180,7 @@ DWORD get_pixel_color( HDC hdc, const dib_info *dib, COLORREF color, BOOL mono_f
COLORREF rgb_ref; COLORREF rgb_ref;
const RGBQUAD *color_table; const RGBQUAD *color_table;
rgb_ref = make_rgb_colorref( hdc, dib, color, &got_pixel, &pixel ); rgb_ref = make_rgb_colorref( dc, dib, color, &got_pixel, &pixel );
if (got_pixel) return pixel; if (got_pixel) return pixel;
if (dib->bit_count != 1 || !mono_fixup) if (dib->bit_count != 1 || !mono_fixup)
...@@ -193,8 +193,8 @@ DWORD get_pixel_color( HDC hdc, const dib_info *dib, COLORREF color, BOOL mono_f ...@@ -193,8 +193,8 @@ DWORD get_pixel_color( HDC hdc, const dib_info *dib, COLORREF color, BOOL mono_f
if(rgbquad_equal(&fg_quad, color_table + 1)) if(rgbquad_equal(&fg_quad, color_table + 1))
return 1; return 1;
pixel = get_pixel_color( hdc, dib, GetBkColor(hdc), FALSE ); pixel = get_pixel_color( dc, dib, dc->backgroundColor, FALSE );
if (color == GetBkColor(hdc)) return pixel; if (color == dc->backgroundColor) return pixel;
else return !pixel; else return !pixel;
} }
...@@ -205,10 +205,10 @@ DWORD get_pixel_color( HDC hdc, const dib_info *dib, COLORREF color, BOOL mono_f ...@@ -205,10 +205,10 @@ DWORD get_pixel_color( HDC hdc, const dib_info *dib, COLORREF color, BOOL mono_f
* there are several fg sources (pen, brush, text) we take as bg the inverse * there are several fg sources (pen, brush, text) we take as bg the inverse
* of the relevant fg color (which is always set up correctly). * of the relevant fg color (which is always set up correctly).
*/ */
static inline void get_color_masks( HDC hdc, const dib_info *dib, UINT rop, COLORREF colorref, static inline void get_color_masks( DC *dc, const dib_info *dib, UINT rop, COLORREF colorref,
INT bkgnd_mode, rop_mask *fg_mask, rop_mask *bg_mask ) INT bkgnd_mode, rop_mask *fg_mask, rop_mask *bg_mask )
{ {
DWORD color = get_pixel_color( hdc, dib, colorref, TRUE ); DWORD color = get_pixel_color( dc, dib, colorref, TRUE );
calc_rop_masks( rop, color, fg_mask ); calc_rop_masks( rop, color, fg_mask );
...@@ -219,8 +219,8 @@ static inline void get_color_masks( HDC hdc, const dib_info *dib, UINT rop, COLO ...@@ -219,8 +219,8 @@ static inline void get_color_masks( HDC hdc, const dib_info *dib, UINT rop, COLO
return; return;
} }
if (dib->bit_count != 1) color = get_pixel_color( hdc, dib, GetBkColor(hdc), FALSE ); if (dib->bit_count != 1) color = get_pixel_color( dc, dib, dc->backgroundColor, FALSE );
else if (colorref != GetBkColor(hdc)) color = !color; else if (colorref != dc->backgroundColor) color = !color;
calc_rop_masks( rop, color, bg_mask ); calc_rop_masks( rop, color, bg_mask );
} }
...@@ -802,6 +802,7 @@ static BOOL solid_pen_line_region( dibdrv_physdev *pdev, POINT *start, POINT *en ...@@ -802,6 +802,7 @@ static BOOL solid_pen_line_region( dibdrv_physdev *pdev, POINT *start, POINT *en
static BOOL solid_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN region) static BOOL solid_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN region)
{ {
DC *dc = get_physdev_dc( &pdev->dev );
int i; int i;
assert( num >= 2 ); assert( num >= 2 );
...@@ -817,8 +818,8 @@ static BOOL solid_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL clos ...@@ -817,8 +818,8 @@ static BOOL solid_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL clos
{ {
DWORD color, and, xor; DWORD color, and, xor;
color = get_pixel_color( pdev->dev.hdc, &pdev->dib, pdev->pen_brush.colorref, TRUE ); color = get_pixel_color( dc, &pdev->dib, pdev->pen_brush.colorref, TRUE );
calc_and_xor_masks( GetROP2(pdev->dev.hdc), color, &and, &xor ); calc_and_xor_masks( dc->ROPmode, color, &and, &xor );
for (i = 0; i < num - 1; i++) for (i = 0; i < num - 1; i++)
if (!solid_pen_line( pdev, pts + i, pts + i + 1, and, xor )) if (!solid_pen_line( pdev, pts + i, pts + i + 1, and, xor ))
...@@ -1214,6 +1215,7 @@ static BOOL dashed_pen_line_region(dibdrv_physdev *pdev, POINT *start, POINT *en ...@@ -1214,6 +1215,7 @@ static BOOL dashed_pen_line_region(dibdrv_physdev *pdev, POINT *start, POINT *en
static BOOL dashed_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN region) static BOOL dashed_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN region)
{ {
DC *dc = get_physdev_dc( &pdev->dev );
int i; int i;
assert( num >= 2 ); assert( num >= 2 );
...@@ -1227,8 +1229,8 @@ static BOOL dashed_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL clo ...@@ -1227,8 +1229,8 @@ static BOOL dashed_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL clo
} }
else else
{ {
get_color_masks( pdev->dev.hdc, &pdev->dib, GetROP2(pdev->dev.hdc), pdev->pen_brush.colorref, get_color_masks( dc, &pdev->dib, dc->ROPmode, pdev->pen_brush.colorref,
pdev->pen_is_ext ? TRANSPARENT : GetBkMode(pdev->dev.hdc), pdev->pen_is_ext ? TRANSPARENT : dc->backgroundMode,
&pdev->dash_masks[1], &pdev->dash_masks[0] ); &pdev->dash_masks[1], &pdev->dash_masks[0] );
for (i = 0; i < num - 1; i++) for (i = 0; i < num - 1; i++)
...@@ -1759,8 +1761,9 @@ COLORREF dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color ) ...@@ -1759,8 +1761,9 @@ COLORREF dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color )
static BOOL solid_brush(dibdrv_physdev *pdev, dib_brush *brush, dib_info *dib, static BOOL solid_brush(dibdrv_physdev *pdev, dib_brush *brush, dib_info *dib,
int num, const RECT *rects, INT rop) int num, const RECT *rects, INT rop)
{ {
DC *dc = get_physdev_dc( &pdev->dev );
rop_mask brush_color; rop_mask brush_color;
DWORD color = get_pixel_color( pdev->dev.hdc, &pdev->dib, brush->colorref, TRUE ); DWORD color = get_pixel_color( dc, &pdev->dib, brush->colorref, TRUE );
calc_rop_masks( rop, color, &brush_color ); calc_rop_masks( rop, color, &brush_color );
dib->funcs->solid_rects( dib, num, rects, brush_color.and, brush_color.xor ); dib->funcs->solid_rects( dib, num, rects, brush_color.and, brush_color.xor );
...@@ -1849,16 +1852,17 @@ static BOOL init_hatch_brush( dibdrv_physdev *pdev, dib_brush *brush ) ...@@ -1849,16 +1852,17 @@ static BOOL init_hatch_brush( dibdrv_physdev *pdev, dib_brush *brush )
static BOOL create_hatch_brush_bits(dibdrv_physdev *pdev, dib_brush *brush, BOOL *needs_reselect) static BOOL create_hatch_brush_bits(dibdrv_physdev *pdev, dib_brush *brush, BOOL *needs_reselect)
{ {
DC *dc = get_physdev_dc( &pdev->dev );
rop_mask fg_mask, bg_mask; rop_mask fg_mask, bg_mask;
if (!init_hatch_brush( pdev, brush )) return FALSE; if (!init_hatch_brush( pdev, brush )) return FALSE;
get_color_masks( pdev->dev.hdc, &pdev->dib, brush->rop, brush->colorref, GetBkMode(pdev->dev.hdc), get_color_masks( dc, &pdev->dib, brush->rop, brush->colorref, dc->backgroundMode,
&fg_mask, &bg_mask ); &fg_mask, &bg_mask );
if (brush->colorref & (1 << 24)) /* PALETTEINDEX */ if (brush->colorref & (1 << 24)) /* PALETTEINDEX */
*needs_reselect = TRUE; *needs_reselect = TRUE;
if (GetBkMode(pdev->dev.hdc) != TRANSPARENT && (GetBkColor(pdev->dev.hdc) & (1 << 24))) if (dc->backgroundMode != TRANSPARENT && (dc->backgroundColor & (1 << 24)))
*needs_reselect = TRUE; *needs_reselect = TRUE;
brush->dib.funcs->create_rop_masks( &brush->dib, hatches[brush->hatch], brush->dib.funcs->create_rop_masks( &brush->dib, hatches[brush->hatch],
...@@ -1871,6 +1875,7 @@ static BOOL create_hatch_brush_bits(dibdrv_physdev *pdev, dib_brush *brush, BOOL ...@@ -1871,6 +1875,7 @@ static BOOL create_hatch_brush_bits(dibdrv_physdev *pdev, dib_brush *brush, BOOL
static BOOL create_dither_brush_bits(dibdrv_physdev *pdev, dib_brush *brush, BOOL *needs_reselect) static BOOL create_dither_brush_bits(dibdrv_physdev *pdev, dib_brush *brush, BOOL *needs_reselect)
{ {
DC *dc = get_physdev_dc( &pdev->dev );
COLORREF rgb; COLORREF rgb;
DWORD pixel; DWORD pixel;
BOOL got_pixel; BOOL got_pixel;
...@@ -1880,7 +1885,7 @@ static BOOL create_dither_brush_bits(dibdrv_physdev *pdev, dib_brush *brush, BOO ...@@ -1880,7 +1885,7 @@ static BOOL create_dither_brush_bits(dibdrv_physdev *pdev, dib_brush *brush, BOO
if (brush->colorref & (1 << 24)) /* PALETTEINDEX */ if (brush->colorref & (1 << 24)) /* PALETTEINDEX */
*needs_reselect = TRUE; *needs_reselect = TRUE;
rgb = make_rgb_colorref( pdev->dev.hdc, &pdev->dib, brush->colorref, &got_pixel, &pixel ); rgb = make_rgb_colorref( dc, &pdev->dib, brush->colorref, &got_pixel, &pixel );
brush->dib.funcs->create_dither_masks( &brush->dib, brush->rop, rgb, &brush->masks ); brush->dib.funcs->create_dither_masks( &brush->dib, brush->rop, rgb, &brush->masks );
...@@ -1912,6 +1917,7 @@ static BOOL matching_pattern_format( dib_info *dib, dib_info *pattern ) ...@@ -1912,6 +1917,7 @@ static BOOL matching_pattern_format( dib_info *dib, dib_info *pattern )
static BOOL select_pattern_brush( dibdrv_physdev *pdev, dib_brush *brush, BOOL *needs_reselect ) static BOOL select_pattern_brush( dibdrv_physdev *pdev, dib_brush *brush, BOOL *needs_reselect )
{ {
DC *dc = get_physdev_dc( &pdev->dev );
char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )]; char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
BITMAPINFO *info = (BITMAPINFO *)buffer; BITMAPINFO *info = (BITMAPINFO *)buffer;
RGBQUAD color_table[2]; RGBQUAD color_table[2];
...@@ -1941,15 +1947,13 @@ static BOOL select_pattern_brush( dibdrv_physdev *pdev, dib_brush *brush, BOOL * ...@@ -1941,15 +1947,13 @@ static BOOL select_pattern_brush( dibdrv_physdev *pdev, dib_brush *brush, BOOL *
BOOL got_pixel; BOOL got_pixel;
COLORREF color; COLORREF color;
color = make_rgb_colorref( pdev->dev.hdc, &pdev->dib, GetTextColor( pdev->dev.hdc ), color = make_rgb_colorref( dc, &pdev->dib, dc->textColor, &got_pixel, &pixel );
&got_pixel, &pixel );
color_table[0].rgbRed = GetRValue( color ); color_table[0].rgbRed = GetRValue( color );
color_table[0].rgbGreen = GetGValue( color ); color_table[0].rgbGreen = GetGValue( color );
color_table[0].rgbBlue = GetBValue( color ); color_table[0].rgbBlue = GetBValue( color );
color_table[0].rgbReserved = 0; color_table[0].rgbReserved = 0;
color = make_rgb_colorref( pdev->dev.hdc, &pdev->dib, GetBkColor( pdev->dev.hdc ), color = make_rgb_colorref( dc, &pdev->dib, dc->backgroundColor, &got_pixel, &pixel );
&got_pixel, &pixel );
color_table[1].rgbRed = GetRValue( color ); color_table[1].rgbRed = GetRValue( color );
color_table[1].rgbGreen = GetGValue( color ); color_table[1].rgbGreen = GetGValue( color );
color_table[1].rgbBlue = GetBValue( color ); color_table[1].rgbBlue = GetBValue( color );
......
...@@ -2008,7 +2008,7 @@ BOOL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect ...@@ -2008,7 +2008,7 @@ BOOL nulldrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags, const RECT *rect
/* make x,y relative to the image bits */ /* make x,y relative to the image bits */
x += src.visrect.left - dst.visrect.left; x += src.visrect.left - dst.visrect.left;
y += src.visrect.top - dst.visrect.top; y += src.visrect.top - dst.visrect.top;
render_aa_text_bitmapinfo( dev->hdc, info, &bits, &src, x, y, flags, render_aa_text_bitmapinfo( dc, info, &bits, &src, x, y, flags,
aa_flags, str, count, dx ); aa_flags, str, count, dx );
err = dst_dev->funcs->pPutImage( dst_dev, 0, info, &bits, &src, &dst, SRCCOPY ); err = dst_dev->funcs->pPutImage( dst_dev, 0, info, &bits, &src, &dst, SRCCOPY );
if (bits.free) bits.free( &bits ); if (bits.free) bits.free( &bits );
......
...@@ -248,7 +248,7 @@ extern DWORD blend_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struc ...@@ -248,7 +248,7 @@ extern DWORD blend_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struc
extern DWORD gradient_bitmapinfo( const BITMAPINFO *info, void *bits, TRIVERTEX *vert_array, ULONG nvert, extern DWORD gradient_bitmapinfo( const BITMAPINFO *info, void *bits, TRIVERTEX *vert_array, ULONG nvert,
void *grad_array, ULONG ngrad, ULONG mode, const POINT *dev_pts, HRGN rgn ) DECLSPEC_HIDDEN; void *grad_array, ULONG ngrad, ULONG mode, const POINT *dev_pts, HRGN rgn ) DECLSPEC_HIDDEN;
extern COLORREF get_pixel_bitmapinfo( const BITMAPINFO *info, void *bits, struct bitblt_coords *src ) DECLSPEC_HIDDEN; extern COLORREF get_pixel_bitmapinfo( const BITMAPINFO *info, void *bits, struct bitblt_coords *src ) DECLSPEC_HIDDEN;
extern BOOL render_aa_text_bitmapinfo( HDC hdc, BITMAPINFO *info, struct gdi_image_bits *bits, extern BOOL render_aa_text_bitmapinfo( DC *dc, BITMAPINFO *info, struct gdi_image_bits *bits,
struct bitblt_coords *src, INT x, INT y, UINT flags, struct bitblt_coords *src, INT x, INT y, UINT flags,
UINT aa_flags, LPCWSTR str, UINT count, const INT *dx ) DECLSPEC_HIDDEN; UINT aa_flags, LPCWSTR str, UINT count, const INT *dx ) DECLSPEC_HIDDEN;
extern DWORD get_image_from_bitmap( BITMAPOBJ *bmp, BITMAPINFO *info, extern DWORD get_image_from_bitmap( BITMAPOBJ *bmp, BITMAPINFO *info,
......
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