Commit 568afc21 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 2b1da8c7
...@@ -245,8 +245,6 @@ extern BOOL convert_dib(dib_info *dst, const dib_info *src) DECLSPEC_HIDDEN; ...@@ -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 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 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_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 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, extern int clip_line(const POINT *start, const POINT *end, const RECT *clip,
const bres_params *params, POINT *pt1, POINT *pt2) DECLSPEC_HIDDEN; const bres_params *params, POINT *pt1, POINT *pt2) DECLSPEC_HIDDEN;
......
...@@ -26,6 +26,20 @@ ...@@ -26,6 +26,20 @@
WINE_DEFAULT_DEBUG_CHANNEL(dib); 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 ) static RECT get_device_rect( HDC hdc, int left, int top, int right, int bottom, BOOL rtl_correction )
{ {
RECT rect; RECT rect;
...@@ -813,7 +827,6 @@ BOOL dibdrv_LineTo( PHYSDEV dev, INT x, INT y ) ...@@ -813,7 +827,6 @@ BOOL dibdrv_LineTo( PHYSDEV dev, INT x, INT y )
if (region) if (region)
{ {
if (pdev->clip) CombineRgn( region, region, pdev->clip, RGN_AND );
ret = pen_region( pdev, region ); ret = pen_region( pdev, region );
DeleteObject( region ); DeleteObject( region );
} }
...@@ -968,7 +981,6 @@ BOOL dibdrv_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* counts, DWO ...@@ -968,7 +981,6 @@ BOOL dibdrv_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* counts, DWO
if (outline) if (outline)
{ {
if (pdev->clip) CombineRgn( outline, outline, pdev->clip, RGN_AND );
ret = pen_region( pdev, outline ); ret = pen_region( pdev, outline );
DeleteObject( outline ); DeleteObject( outline );
} }
......
...@@ -2162,17 +2162,3 @@ BOOL brush_rect(dibdrv_physdev *pdev, dib_brush *brush, const RECT *rect, HRGN c ...@@ -2162,17 +2162,3 @@ BOOL brush_rect(dibdrv_physdev *pdev, dib_brush *brush, const RECT *rect, HRGN c
free_clipped_rects( &clipped_rects ); free_clipped_rects( &clipped_rects );
return ret; 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 ));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment