Module: wine Branch: master Commit: 9b8d920cb736eab30d65690f960b1833cbb00600 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9b8d920cb736eab30d65690f96...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Dec 28 11:28:21 2011 +0100
gdi32: Pass the clip region to the brush_rect helper and add a similar helper for pens.
---
dlls/gdi32/dibdrv/dibdrv.h | 3 ++- dlls/gdi32/dibdrv/graphics.c | 8 +++----- dlls/gdi32/dibdrv/objects.c | 32 ++++++++++++++++++-------------- 3 files changed, 23 insertions(+), 20 deletions(-)
diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h index 85aa2cf..8649752 100644 --- a/dlls/gdi32/dibdrv/dibdrv.h +++ b/dlls/gdi32/dibdrv/dibdrv.h @@ -229,7 +229,8 @@ extern void copy_dib_color_info(dib_info *dst, const dib_info *src) DECLSPEC_HID extern BOOL convert_dib(dib_info *dst, const dib_info *src) DECLSPEC_HIDDEN; extern COLORREF make_rgb_colorref( HDC hdc, dib_info *dib, COLORREF color, BOOL *got_pixel, DWORD *pixel ) DECLSPEC_HIDDEN; extern DWORD get_pixel_color(dibdrv_physdev *pdev, COLORREF color, BOOL mono_fixup) DECLSPEC_HIDDEN; -extern BOOL brush_rect( dibdrv_physdev *pdev, const RECT *rect, INT rop ) DECLSPEC_HIDDEN; +extern BOOL brush_rect( dibdrv_physdev *pdev, const RECT *rect, HRGN clip, INT rop ) DECLSPEC_HIDDEN; +extern BOOL pen_rect(dibdrv_physdev *pdev, const RECT *rect, HRGN clip, INT rop) 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 clip_line(const POINT *start, const POINT *end, const RECT *clip, const bres_params *params, POINT *pt1, POINT *pt2) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c index c84cce2..e5aad2a 100644 --- a/dlls/gdi32/dibdrv/graphics.c +++ b/dlls/gdi32/dibdrv/graphics.c @@ -479,7 +479,7 @@ BOOL dibdrv_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop )
TRACE("(%p, %d, %d, %d, %d, %06x)\n", dev, dst->x, dst->y, dst->width, dst->height, rop);
- return brush_rect( pdev, &dst->visrect, get_rop2_from_rop(rop) ); + return brush_rect( pdev, &dst->visrect, pdev->clip, get_rop2_from_rop(rop) ); }
/*********************************************************************** @@ -501,7 +501,7 @@ BOOL dibdrv_PaintRgn( PHYSDEV dev, HRGN rgn ) { rect = get_device_rect( dev->hdc, region->rects[i].left, region->rects[i].top, region->rects[i].right, region->rects[i].bottom, FALSE ); - brush_rect( pdev, &rect, GetROP2( dev->hdc ) ); + brush_rect( pdev, &rect, pdev->clip, GetROP2( dev->hdc ) ); }
release_wine_region( rgn ); @@ -603,9 +603,7 @@ BOOL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) rect.right -= (pdev->pen_width + 2) / 2; rect.bottom -= (pdev->pen_width + 2) / 2;
- brush_rect( pdev, &rect, GetROP2(dev->hdc) ); - - return TRUE; + return brush_rect( pdev, &rect, pdev->clip, GetROP2(dev->hdc) ); }
/*********************************************************************** diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c index 79ae047..e203af7 100644 --- a/dlls/gdi32/dibdrv/objects.c +++ b/dlls/gdi32/dibdrv/objects.c @@ -1227,22 +1227,11 @@ static HRGN get_wide_lines_region( dibdrv_physdev *pdev, int num, POINT *pts, BO
static BOOL wide_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close) { - struct clipped_rects clipped_rects; - rop_mask color; HRGN region; - DWORD pen_color = get_pixel_color( pdev, pdev->pen_colorref, TRUE ); - - calc_rop_masks( GetROP2(pdev->dev.hdc), pen_color, &color );
region = get_wide_lines_region( pdev, num, pts, close ); if (pdev->clip) CombineRgn( region, region, pdev->clip, RGN_AND ); - - if (get_clipped_rects( &pdev->dib, NULL, region, &clipped_rects )) - { - pdev->dib.funcs->solid_rects( &pdev->dib, clipped_rects.count, clipped_rects.rects, - color.and, color.xor ); - free_clipped_rects( &clipped_rects ); - } + pen_rect( pdev, NULL, region, GetROP2( pdev->dev.hdc ) ); DeleteObject( region ); return TRUE; } @@ -1715,13 +1704,28 @@ COLORREF dibdrv_SetDCBrushColor( PHYSDEV dev, COLORREF color ) return next->funcs->pSetDCBrushColor( next, color ); }
-BOOL brush_rect(dibdrv_physdev *pdev, const RECT *rect, INT rop) +BOOL brush_rect(dibdrv_physdev *pdev, const RECT *rect, HRGN clip, INT rop) { struct clipped_rects clipped_rects; BOOL ret;
- if (!get_clipped_rects( &pdev->dib, rect, pdev->clip, &clipped_rects )) return TRUE; + if (!get_clipped_rects( &pdev->dib, rect, clip, &clipped_rects )) return TRUE; ret = pdev->brush_rects( pdev, &pdev->dib, clipped_rects.count, clipped_rects.rects, rop ); free_clipped_rects( &clipped_rects ); return ret; } + +BOOL pen_rect(dibdrv_physdev *pdev, const RECT *rect, HRGN clip, INT rop) +{ + struct clipped_rects clipped_rects; + rop_mask color; + DWORD pen_color = get_pixel_color( pdev, pdev->pen_colorref, TRUE ); + + if (!get_clipped_rects( &pdev->dib, rect, clip, &clipped_rects )) return TRUE; + + calc_rop_masks( rop, pen_color, &color ); + pdev->dib.funcs->solid_rects( &pdev->dib, clipped_rects.count, clipped_rects.rects, + color.and, color.xor ); + free_clipped_rects( &clipped_rects ); + return TRUE; +}