gdi32: Change the object-level brush function to accept a stand-alone dib and a separate clip region.

This commit is contained in:
Huw Davies 2011-08-19 16:26:20 +01:00 committed by Alexandre Julliard
parent c6f6c3f727
commit 925fa10865
4 changed files with 34 additions and 15 deletions

View File

@ -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 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_fg_color(dibdrv_physdev *pdev, COLORREF color) 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) static inline BOOL defer_pen(dibdrv_physdev *pdev)
{ {

View File

@ -107,7 +107,7 @@ BOOL dibdrv_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop )
update_brush_rop( pdev, rop2 ); 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) ); 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, rect = get_device_rect( dev->hdc, region->rects[i].left, region->rects[i].top,
region->rects[i].right, region->rects[i].bottom, FALSE ); region->rects[i].right, region->rects[i].bottom, FALSE );
pdev->brush_rects( pdev, 1, &rect ); brush_rects( pdev, 1, &rect );
} }
release_wine_region( rgn ); 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.right -= 1;
rect.bottom -= 1; rect.bottom -= 1;
pdev->brush_rects(pdev, 1, &rect); brush_rects(pdev, 1, &rect);
return TRUE; return TRUE;
} }

View File

@ -1059,10 +1059,16 @@ COLORREF dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color )
* Fill a number of rectangles with the solid brush * Fill a number of rectangles with the solid brush
* FIXME: Should we insist l < r && t < b? Currently we assume this. * 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; 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++) 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 && 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) 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; 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.right = min(rect.right, clip->rects[j].right);
rect.bottom = min(rect.bottom, clip->rects[j].bottom); 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; return TRUE;
} }
@ -1205,7 +1211,7 @@ static BOOL create_hatch_brush_bits(dibdrv_physdev *pdev)
* Fill a number of rectangles with the pattern brush * Fill a number of rectangles with the pattern brush
* FIXME: Should we insist l < r && t < b? Currently we assume this. * 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; int i, j;
const WINEREGION *clip; const WINEREGION *clip;
@ -1233,7 +1239,14 @@ static BOOL pattern_brush(dibdrv_physdev *pdev, int num, RECT *rects)
GetBrushOrgEx(pdev->dev.hdc, &origin); 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(i = 0; i < num; i++)
{ {
for(j = 0; j < clip->numRects; j++) 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 && 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) 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; 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.right = min(rect.right, clip->rects[j].right);
rect.bottom = min(rect.bottom, clip->rects[j].bottom); 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; 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; return TRUE;
} }
@ -1392,3 +1405,8 @@ COLORREF dibdrv_SetDCBrushColor( PHYSDEV dev, COLORREF color )
return next->funcs->pSetDCBrushColor( next, 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 );
}

View File

@ -146,7 +146,7 @@ typedef struct dibdrv_physdev
DWORD brush_color, brush_and, brush_xor; DWORD brush_color, brush_and, brush_xor;
dib_info brush_dib; dib_info brush_dib;
void *brush_and_bits, *brush_xor_bits; 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 */ /* background */
DWORD bkgnd_color, bkgnd_and, bkgnd_xor; DWORD bkgnd_color, bkgnd_and, bkgnd_xor;