Module: wine Branch: master Commit: 925fa108657239ae1672a12299432f696723a072 URL: http://source.winehq.org/git/wine.git/?a=commit;h=925fa108657239ae1672a12299...
Author: Huw Davies huw@codeweavers.com Date: Fri Aug 19 16:26:20 2011 +0100
gdi32: Change the object-level brush function to accept a stand-alone dib and a separate clip region.
---
dlls/gdi32/dibdrv/dibdrv.h | 1 + dlls/gdi32/dibdrv/graphics.c | 6 +++--- dlls/gdi32/dibdrv/objects.c | 40 +++++++++++++++++++++++++++++----------- dlls/gdi32/gdi_private.h | 2 +- 4 files changed, 34 insertions(+), 15 deletions(-)
diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h index 760c02e..6727a6b 100644 --- a/dlls/gdi32/dibdrv/dibdrv.h +++ b/dlls/gdi32/dibdrv/dibdrv.h @@ -75,6 +75,7 @@ extern void free_pattern_brush(dibdrv_physdev *pdev) 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 DWORD get_fg_color(dibdrv_physdev *pdev, COLORREF color) DECLSPEC_HIDDEN; +extern BOOL brush_rects( dibdrv_physdev *pdev, int num, const RECT *rects ) DECLSPEC_HIDDEN;
static inline BOOL defer_pen(dibdrv_physdev *pdev) { diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c index b2e9f2c..f8b3f8a 100644 --- a/dlls/gdi32/dibdrv/graphics.c +++ b/dlls/gdi32/dibdrv/graphics.c @@ -107,7 +107,7 @@ BOOL dibdrv_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop )
update_brush_rop( pdev, rop2 );
- done = pdev->brush_rects( pdev, 1, &dst->visrect ); + done = brush_rects( pdev, 1, &dst->visrect );
update_brush_rop( pdev, GetROP2(dev->hdc) );
@@ -139,7 +139,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 ); - pdev->brush_rects( pdev, 1, &rect ); + brush_rects( pdev, 1, &rect ); }
release_wine_region( rgn ); @@ -236,7 +236,7 @@ BOOL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) rect.right -= 1; rect.bottom -= 1;
- pdev->brush_rects(pdev, 1, &rect); + brush_rects(pdev, 1, &rect);
return TRUE; } diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c index e0e37f7..8575bb4 100644 --- a/dlls/gdi32/dibdrv/objects.c +++ b/dlls/gdi32/dibdrv/objects.c @@ -1059,10 +1059,16 @@ COLORREF dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color ) * Fill a number of rectangles with the solid brush * FIXME: Should we insist l < r && t < b? Currently we assume this. */ -static BOOL solid_brush(dibdrv_physdev *pdev, int num, RECT *rects) +static BOOL solid_brush(dibdrv_physdev *pdev, dib_info *dib, int num, const RECT *rects, HRGN region) { int i, j; - const WINEREGION *clip = get_wine_region(pdev->clip); + const WINEREGION *clip = get_wine_region( region ); + + if (!clip) + { + dib->funcs->solid_rects( dib, num, rects, pdev->brush_and, pdev->brush_xor ); + return TRUE; + }
for(i = 0; i < num; i++) { @@ -1074,7 +1080,7 @@ static BOOL solid_brush(dibdrv_physdev *pdev, int num, RECT *rects) if(clip->rects[j].top <= rect.top && clip->rects[j].bottom >= rect.bottom && clip->rects[j].left <= rect.left && clip->rects[j].right >= rect.right) { - pdev->dib.funcs->solid_rects(&pdev->dib, 1, &rect, pdev->brush_and, pdev->brush_xor); + dib->funcs->solid_rects( dib, 1, &rect, pdev->brush_and, pdev->brush_xor ); break; }
@@ -1088,11 +1094,11 @@ static BOOL solid_brush(dibdrv_physdev *pdev, int num, RECT *rects) rect.right = min(rect.right, clip->rects[j].right); rect.bottom = min(rect.bottom, clip->rects[j].bottom);
- pdev->dib.funcs->solid_rects(&pdev->dib, 1, &rect, pdev->brush_and, pdev->brush_xor); + dib->funcs->solid_rects( dib, 1, &rect, pdev->brush_and, pdev->brush_xor ); } } } - release_wine_region(pdev->clip); + release_wine_region( region ); return TRUE; }
@@ -1205,7 +1211,7 @@ static BOOL create_hatch_brush_bits(dibdrv_physdev *pdev) * Fill a number of rectangles with the pattern brush * FIXME: Should we insist l < r && t < b? Currently we assume this. */ -static BOOL pattern_brush(dibdrv_physdev *pdev, int num, RECT *rects) +static BOOL pattern_brush(dibdrv_physdev *pdev, dib_info *dib, int num, const RECT *rects, HRGN region) { int i, j; const WINEREGION *clip; @@ -1233,7 +1239,14 @@ static BOOL pattern_brush(dibdrv_physdev *pdev, int num, RECT *rects)
GetBrushOrgEx(pdev->dev.hdc, &origin);
- clip = get_wine_region(pdev->clip); + clip = get_wine_region( region ); + + if (!clip) + { + dib->funcs->pattern_rects( dib, num, rects, &origin, &pdev->brush_dib, pdev->brush_and_bits, pdev->brush_xor_bits ); + return TRUE; + } + for(i = 0; i < num; i++) { for(j = 0; j < clip->numRects; j++) @@ -1244,7 +1257,7 @@ static BOOL pattern_brush(dibdrv_physdev *pdev, int num, RECT *rects) if(clip->rects[j].top <= rect.top && clip->rects[j].bottom >= rect.bottom && clip->rects[j].left <= rect.left && clip->rects[j].right >= rect.right) { - pdev->dib.funcs->pattern_rects(&pdev->dib, 1, &rect, &origin, &pdev->brush_dib, pdev->brush_and_bits, pdev->brush_xor_bits); + dib->funcs->pattern_rects( dib, 1, &rect, &origin, &pdev->brush_dib, pdev->brush_and_bits, pdev->brush_xor_bits ); break; }
@@ -1258,15 +1271,15 @@ static BOOL pattern_brush(dibdrv_physdev *pdev, int num, RECT *rects) rect.right = min(rect.right, clip->rects[j].right); rect.bottom = min(rect.bottom, clip->rects[j].bottom);
- pdev->dib.funcs->pattern_rects(&pdev->dib, 1, &rect, &origin, &pdev->brush_dib, pdev->brush_and_bits, pdev->brush_xor_bits); + dib->funcs->pattern_rects( dib, 1, &rect, &origin, &pdev->brush_dib, pdev->brush_and_bits, pdev->brush_xor_bits ); } } } - release_wine_region(pdev->clip); + release_wine_region( region ); return TRUE; }
-static BOOL null_brush(dibdrv_physdev *pdev, int num, RECT *rects) +static BOOL null_brush(dibdrv_physdev *pdev, dib_info *dib, int num, const RECT *rects, HRGN region) { return TRUE; } @@ -1392,3 +1405,8 @@ COLORREF dibdrv_SetDCBrushColor( PHYSDEV dev, COLORREF color )
return next->funcs->pSetDCBrushColor( next, color ); } + +BOOL brush_rects(dibdrv_physdev *pdev, int num, const RECT *rects) +{ + return pdev->brush_rects( pdev, &pdev->dib, num, rects, pdev->clip ); +} diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 40271af..2189040 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -146,7 +146,7 @@ typedef struct dibdrv_physdev DWORD brush_color, brush_and, brush_xor; dib_info brush_dib; void *brush_and_bits, *brush_xor_bits; - BOOL (* brush_rects)(struct dibdrv_physdev *pdev, int num, RECT *rects); + BOOL (* brush_rects)(struct dibdrv_physdev *pdev, dib_info *dib, int num, const RECT *rects, HRGN clip);
/* background */ DWORD bkgnd_color, bkgnd_and, bkgnd_xor;