gdi32: Move the pen/brush_region helpers to graphics.c and avoid redundant clipping.

This commit is contained in:
Alexandre Julliard 2012-04-13 13:36:23 +02:00
parent 2b1da8c77f
commit 568afc210e
3 changed files with 14 additions and 18 deletions

View File

@ -245,8 +245,6 @@ 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, dib_brush *brush, const RECT *rect, HRGN clip, INT rop ) DECLSPEC_HIDDEN;
extern BOOL brush_region( dibdrv_physdev *pdev, HRGN region ) DECLSPEC_HIDDEN;
extern BOOL pen_region( dibdrv_physdev *pdev, HRGN region ) 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

@ -26,6 +26,20 @@
WINE_DEFAULT_DEBUG_CHANNEL(dib);
/* paint a region with the brush (note: the region can be modified) */
static BOOL brush_region( dibdrv_physdev *pdev, HRGN region )
{
if (pdev->clip) CombineRgn( region, region, pdev->clip, RGN_AND );
return brush_rect( pdev, &pdev->brush, NULL, region, GetROP2( pdev->dev.hdc ));
}
/* paint a region with the pen (note: the region can be modified) */
static BOOL pen_region( dibdrv_physdev *pdev, HRGN region )
{
if (pdev->clip) CombineRgn( region, region, pdev->clip, RGN_AND );
return brush_rect( pdev, &pdev->pen_brush, NULL, region, GetROP2( pdev->dev.hdc ));
}
static RECT get_device_rect( HDC hdc, int left, int top, int right, int bottom, BOOL rtl_correction )
{
RECT rect;
@ -813,7 +827,6 @@ BOOL dibdrv_LineTo( PHYSDEV dev, INT x, INT y )
if (region)
{
if (pdev->clip) CombineRgn( region, region, pdev->clip, RGN_AND );
ret = pen_region( pdev, region );
DeleteObject( region );
}
@ -968,7 +981,6 @@ BOOL dibdrv_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* counts, DWO
if (outline)
{
if (pdev->clip) CombineRgn( outline, outline, pdev->clip, RGN_AND );
ret = pen_region( pdev, outline );
DeleteObject( outline );
}

View File

@ -2162,17 +2162,3 @@ BOOL brush_rect(dibdrv_physdev *pdev, dib_brush *brush, const RECT *rect, HRGN c
free_clipped_rects( &clipped_rects );
return ret;
}
/* paint a region with the brush (note: the region can be modified) */
BOOL brush_region( dibdrv_physdev *pdev, HRGN region )
{
if (pdev->clip) CombineRgn( region, region, pdev->clip, RGN_AND );
return brush_rect( pdev, &pdev->brush, NULL, region, GetROP2( pdev->dev.hdc ));
}
/* paint a region with the pen (note: the region can be modified) */
BOOL pen_region( dibdrv_physdev *pdev, HRGN region )
{
if (pdev->clip) CombineRgn( region, region, pdev->clip, RGN_AND );
return brush_rect( pdev, &pdev->pen_brush, NULL, region, GetROP2( pdev->dev.hdc ));
}