From: Huw Davies Subject: [PATCH 1/2] gdi32: Add a helper to fill rectangles with a given pixel. Message-Id: <20170724094704.56745-1-huw@codeweavers.com> Date: Mon, 24 Jul 2017 10:47:03 +0100 Signed-off-by: Huw Davies --- dlls/gdi32/dibdrv/dibdrv.h | 1 + dlls/gdi32/dibdrv/objects.c | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h index 770e89eb1b..adf16c42df 100644 --- a/dlls/gdi32/dibdrv/dibdrv.h +++ b/dlls/gdi32/dibdrv/dibdrv.h @@ -257,6 +257,7 @@ extern void add_clipped_bounds( dibdrv_physdev *dev, const RECT *rect, HRGN clip extern int clip_line(const POINT *start, const POINT *end, const RECT *clip, const bres_params *params, POINT *pt1, POINT *pt2) DECLSPEC_HIDDEN; extern void release_cached_font( struct cached_font *font ) DECLSPEC_HIDDEN; +extern BOOL fill_with_pixel( DC *dc, dib_info *dib, DWORD pixel, int num, const RECT *rects, INT rop ) DECLSPEC_HIDDEN; static inline void init_clipped_rects( struct clipped_rects *clip_rects ) { diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c index cde20e3ff1..8e55d1a54f 100644 --- a/dlls/gdi32/dibdrv/objects.c +++ b/dlls/gdi32/dibdrv/objects.c @@ -1754,6 +1754,20 @@ COLORREF dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color ) } /********************************************************************** + * fill_with_pixel + * + * Fill a number of rectangles with a given pixel color and rop mode + */ +BOOL fill_with_pixel( DC *dc, dib_info *dib, DWORD pixel, int num, const RECT *rects, INT rop ) +{ + rop_mask mask; + + calc_rop_masks( rop, pixel, &mask ); + dib->funcs->solid_rects( dib, num, rects, mask.and, mask.xor ); + return TRUE; +} + +/********************************************************************** * solid_brush * * Fill a number of rectangles with the solid brush @@ -1762,12 +1776,9 @@ static BOOL solid_brush(dibdrv_physdev *pdev, dib_brush *brush, dib_info *dib, int num, const RECT *rects, INT rop) { DC *dc = get_physdev_dc( &pdev->dev ); - rop_mask brush_color; DWORD color = get_pixel_color( dc, &pdev->dib, brush->colorref, TRUE ); - calc_rop_masks( rop, color, &brush_color ); - dib->funcs->solid_rects( dib, num, rects, brush_color.and, brush_color.xor ); - return TRUE; + return fill_with_pixel( dc, dib, color, num, rects, rop ); } static BOOL alloc_brush_mask_bits( dib_brush *brush ) -- 2.12.0