gdi32: Pass a DC pointer to get_mono_dc_colors().

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2016-07-28 10:49:46 +01:00 committed by Alexandre Julliard
parent 4b815d525a
commit cf386b8b64
4 changed files with 10 additions and 9 deletions

View File

@ -222,10 +222,10 @@ static DWORD blend_bits( const BITMAPINFO *src_info, const struct gdi_image_bits
}
/* helper to retrieve either both colors or only the background color for monochrome blits */
void get_mono_dc_colors( HDC hdc, BITMAPINFO *info, int count )
void get_mono_dc_colors( DC *dc, BITMAPINFO *info, int count )
{
RGBQUAD *colors = info->bmiColors;
COLORREF color = GetBkColor( hdc );
COLORREF color = dc->backgroundColor;
colors[count - 1].rgbRed = GetRValue( color );
colors[count - 1].rgbGreen = GetGValue( color );
@ -234,7 +234,7 @@ void get_mono_dc_colors( HDC hdc, BITMAPINFO *info, int count )
if (count > 1)
{
color = GetTextColor( hdc );
color = dc->textColor;
colors[0].rgbRed = GetRValue( color );
colors[0].rgbGreen = GetGValue( color );
colors[0].rgbBlue = GetBValue( color );
@ -275,7 +275,7 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
/* 1-bpp source without a color table uses the destination DC colors */
if (src_info->bmiHeader.biBitCount == 1 && !src_info->bmiHeader.biClrUsed)
get_mono_dc_colors( dst_dev->hdc, src_info, 2 );
get_mono_dc_colors( dc_dst, src_info, 2 );
if (dst_info->bmiHeader.biBitCount == 1 && !dst_colors)
{
@ -283,9 +283,9 @@ BOOL nulldrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst,
* that contains only the background color; except with a 1-bpp source,
* in which case it uses the source colors */
if (src_info->bmiHeader.biBitCount > 1)
get_mono_dc_colors( src_dev->hdc, dst_info, 1 );
get_mono_dc_colors( dc_src, dst_info, 1 );
else
get_mono_dc_colors( src_dev->hdc, dst_info, 2 );
get_mono_dc_colors( dc_src, dst_info, 2 );
}
if (!(err = convert_bits( src_info, src, dst_info, &bits )))

View File

@ -581,7 +581,7 @@ INT nulldrv_StretchDIBits( PHYSDEV dev, INT xDst, INT yDst, INT widthDst, INT he
if (dst_info->bmiHeader.biBitCount == 1 && !dst_colors)
{
if (src_info->bmiHeader.biBitCount > 1)
get_mono_dc_colors( dev->hdc, dst_info, 1 );
get_mono_dc_colors( dc, dst_info, 1 );
else
{
memcpy( dst_info->bmiColors, src_info->bmiColors, 2 * sizeof(dst_info->bmiColors[0]) );

View File

@ -985,6 +985,7 @@ DWORD dibdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
const struct gdi_image_bits *bits, struct bitblt_coords *src,
struct bitblt_coords *dst, DWORD rop )
{
DC *dc = get_physdev_dc( dev );
struct clipped_rects clipped_rects;
DWORD ret = ERROR_SUCCESS;
dib_info src_dib;
@ -1000,7 +1001,7 @@ DWORD dibdrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
/* For mask_rect, 1-bpp source without a color table uses the destination DC colors */
if (info->bmiHeader.biBitCount == 1 && pdev->dib.bit_count != 1 && !info->bmiHeader.biClrUsed)
get_mono_dc_colors( dev->hdc, info, 2 );
get_mono_dc_colors( dc, info, 2 );
init_dib_info_from_bitmapinfo( &src_dib, info, bits->ptr );
src_dib.bits.is_copy = bits->is_copy;

View File

@ -199,7 +199,7 @@ extern BOOL intersect_vis_rectangles( struct bitblt_coords *dst, struct bitblt_c
extern DWORD stretch_bits( const BITMAPINFO *src_info, struct bitblt_coords *src,
BITMAPINFO *dst_info, struct bitblt_coords *dst,
struct gdi_image_bits *bits, int mode ) DECLSPEC_HIDDEN;
extern void get_mono_dc_colors( HDC hdc, BITMAPINFO *info, int count ) DECLSPEC_HIDDEN;
extern void get_mono_dc_colors( DC *dc, BITMAPINFO *info, int count ) DECLSPEC_HIDDEN;
/* brush.c */
extern BOOL store_brush_pattern( LOGBRUSH *brush, struct brush_pattern *pattern ) DECLSPEC_HIDDEN;