gdi32: Pass the clip region to the brush_rect helper and add a similar helper for pens.

oldstable
Alexandre Julliard 2011-12-28 11:28:21 +01:00
parent 18c20964e1
commit 9b8d920cb7
3 changed files with 23 additions and 20 deletions

View File

@ -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;

View File

@ -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) );
}
/***********************************************************************

View File

@ -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;
}