gdi32: Add support for updating a region from the pen backend functions instead of painting directly.

This commit is contained in:
Alexandre Julliard 2011-12-28 11:56:24 +01:00
parent 277361d7be
commit 0429d9181f
3 changed files with 15 additions and 16 deletions

View File

@ -89,7 +89,7 @@ typedef struct dibdrv_physdev
dash_pattern pen_pattern;
dash_pos dash_pos;
rop_mask dash_masks[2];
BOOL (* pen_lines)(struct dibdrv_physdev *pdev, int num, POINT *pts, BOOL close);
BOOL (* pen_lines)(struct dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN region);
/* brush */
UINT brush_style;

View File

@ -453,7 +453,7 @@ BOOL dibdrv_LineTo( PHYSDEV dev, INT x, INT y )
reset_dash_origin(pdev);
if(defer_pen(pdev) || !pdev->pen_lines(pdev, 2, pts, FALSE))
if(defer_pen(pdev) || !pdev->pen_lines(pdev, 2, pts, FALSE, 0))
return next->funcs->pLineTo( next, x, y );
return TRUE;
@ -532,7 +532,7 @@ BOOL dibdrv_PolyPolyline( PHYSDEV dev, const POINT* pt, const DWORD* counts, DWO
LPtoDP( dev->hdc, points, counts[i] );
reset_dash_origin( pdev );
pdev->pen_lines( pdev, counts[i], points, FALSE );
pdev->pen_lines( pdev, counts[i], points, FALSE, 0 );
}
HeapFree( GetProcessHeap(), 0, points );
@ -557,7 +557,7 @@ BOOL dibdrv_Polyline( PHYSDEV dev, const POINT* pt, INT count )
LPtoDP( dev->hdc, points, count );
reset_dash_origin( pdev );
pdev->pen_lines( pdev, count, points, FALSE );
pdev->pen_lines( pdev, count, points, FALSE, 0 );
HeapFree( GetProcessHeap(), 0, points );
return TRUE;
@ -596,7 +596,7 @@ BOOL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
pts[1].x = pts[2].x = rect.left;
pts[2].y = pts[3].y = rect.bottom - 1;
pdev->pen_lines(pdev, 4, pts, TRUE);
pdev->pen_lines(pdev, 4, pts, TRUE, 0);
rect.left += (pdev->pen_width + 1) / 2;
rect.top += (pdev->pen_width + 1) / 2;

View File

@ -631,7 +631,7 @@ static BOOL solid_pen_line(dibdrv_physdev *pdev, POINT *start, POINT *end, DWORD
return TRUE;
}
static BOOL solid_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close)
static BOOL solid_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN region)
{
int i;
DWORD color, and, xor;
@ -927,7 +927,7 @@ static BOOL dashed_pen_line(dibdrv_physdev *pdev, POINT *start, POINT *end)
return TRUE;
}
static BOOL dashed_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close)
static BOOL dashed_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN region)
{
int i;
@ -945,7 +945,7 @@ static BOOL dashed_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL clo
return TRUE;
}
static BOOL null_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close)
static BOOL null_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN region)
{
return TRUE;
}
@ -1072,15 +1072,13 @@ static void add_join( dibdrv_physdev *pdev, HRGN region, const POINT *pt,
return;
}
static HRGN get_wide_lines_region( dibdrv_physdev *pdev, int num, POINT *pts, BOOL close )
static BOOL get_wide_lines_region( dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN total )
{
int i;
HRGN total, segment;
HRGN segment;
assert( num >= 2 );
total = CreateRectRgn( 0, 0, 0, 0 );
if (!close) num--;
for (i = 0; i < num; i++)
{
@ -1223,14 +1221,15 @@ static HRGN get_wide_lines_region( dibdrv_physdev *pdev, int num, POINT *pts, BO
prev_face = face_2;
}
return total;
return TRUE;
}
static BOOL wide_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close)
static BOOL wide_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts, BOOL close, HRGN region)
{
HRGN region;
if (region) return get_wide_lines_region( pdev, num, pts, close, region );
region = get_wide_lines_region( pdev, num, pts, close );
if (!(region = CreateRectRgn( 0, 0, 0, 0 ))) return FALSE;
get_wide_lines_region( pdev, num, pts, close, region );
if (pdev->clip) CombineRgn( region, region, pdev->clip, RGN_AND );
pen_rect( pdev, NULL, region, GetROP2( pdev->dev.hdc ) );
DeleteObject( region );