Commit 0f40ad8a authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

gdi32: Move to using a multi-line pen object-level function.

parent 1e83fd00
...@@ -73,7 +73,7 @@ BOOL dibdrv_LineTo( PHYSDEV dev, INT x, INT y ) ...@@ -73,7 +73,7 @@ BOOL dibdrv_LineTo( PHYSDEV dev, INT x, INT y )
reset_dash_origin(pdev); reset_dash_origin(pdev);
if(defer_pen(pdev) || !pdev->pen_line(pdev, pts, pts + 1)) if(defer_pen(pdev) || !pdev->pen_lines(pdev, 2, pts))
return next->funcs->pLineTo( next, x, y ); return next->funcs->pLineTo( next, x, y );
return TRUE; return TRUE;
...@@ -154,7 +154,7 @@ BOOL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) ...@@ -154,7 +154,7 @@ BOOL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pRectangle ); PHYSDEV next = GET_NEXT_PHYSDEV( dev, pRectangle );
dibdrv_physdev *pdev = get_dibdrv_pdev(dev); dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
RECT rect = get_device_rect( dev->hdc, left, top, right, bottom, TRUE ); RECT rect = get_device_rect( dev->hdc, left, top, right, bottom, TRUE );
POINT pts[4]; POINT pts[5];
TRACE("(%p, %d, %d, %d, %d)\n", dev, left, top, right, bottom); TRACE("(%p, %d, %d, %d, %d)\n", dev, left, top, right, bottom);
...@@ -170,11 +170,9 @@ BOOL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) ...@@ -170,11 +170,9 @@ BOOL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
pts[0].y = pts[1].y = rect.top; pts[0].y = pts[1].y = rect.top;
pts[1].x = pts[2].x = rect.left; pts[1].x = pts[2].x = rect.left;
pts[2].y = pts[3].y = rect.bottom - 1; pts[2].y = pts[3].y = rect.bottom - 1;
pts[4] = pts[0];
pdev->pen_line(pdev, pts , pts + 1); pdev->pen_lines(pdev, 5, pts);
pdev->pen_line(pdev, pts + 1, pts + 2);
pdev->pen_line(pdev, pts + 2, pts + 3);
pdev->pen_line(pdev, pts + 3, pts );
/* FIXME: Will need updating when we support wide pens */ /* FIXME: Will need updating when we support wide pens */
......
...@@ -647,6 +647,18 @@ static BOOL solid_pen_line(dibdrv_physdev *pdev, POINT *start, POINT *end) ...@@ -647,6 +647,18 @@ static BOOL solid_pen_line(dibdrv_physdev *pdev, POINT *start, POINT *end)
return TRUE; return TRUE;
} }
static BOOL solid_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts)
{
int i;
assert( num >= 2 );
for (i = 0; i < num - 1; i++)
if (!solid_pen_line( pdev, pts + i, pts + i + 1 ))
return FALSE;
return TRUE;
}
void reset_dash_origin(dibdrv_physdev *pdev) void reset_dash_origin(dibdrv_physdev *pdev)
{ {
pdev->dash_pos.cur_dash = 0; pdev->dash_pos.cur_dash = 0;
...@@ -920,7 +932,19 @@ static BOOL dashed_pen_line(dibdrv_physdev *pdev, POINT *start, POINT *end) ...@@ -920,7 +932,19 @@ static BOOL dashed_pen_line(dibdrv_physdev *pdev, POINT *start, POINT *end)
return TRUE; return TRUE;
} }
static BOOL null_pen_line(dibdrv_physdev *pdev, POINT *start, POINT *end) static BOOL dashed_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts)
{
int i;
assert( num >= 2 );
for (i = 0; i < num - 1; i++)
if (!dashed_pen_line( pdev, pts + i, pts + i + 1 ))
return FALSE;
return TRUE;
}
static BOOL null_pen_lines(dibdrv_physdev *pdev, int num, POINT *pts)
{ {
return TRUE; return TRUE;
} }
...@@ -984,7 +1008,7 @@ HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen ) ...@@ -984,7 +1008,7 @@ HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen )
case PS_SOLID: case PS_SOLID:
if(logpen.lopnStyle & PS_GEOMETRIC) break; if(logpen.lopnStyle & PS_GEOMETRIC) break;
if(logpen.lopnWidth.x > 1) break; if(logpen.lopnWidth.x > 1) break;
pdev->pen_line = solid_pen_line; pdev->pen_lines = solid_pen_lines;
pdev->defer &= ~DEFER_PEN; pdev->defer &= ~DEFER_PEN;
break; break;
...@@ -994,13 +1018,13 @@ HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen ) ...@@ -994,13 +1018,13 @@ HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen )
case PS_DASHDOTDOT: case PS_DASHDOTDOT:
if(logpen.lopnStyle & PS_GEOMETRIC) break; if(logpen.lopnStyle & PS_GEOMETRIC) break;
if(logpen.lopnWidth.x > 1) break; if(logpen.lopnWidth.x > 1) break;
pdev->pen_line = dashed_pen_line; pdev->pen_lines = dashed_pen_lines;
pdev->pen_pattern = dash_patterns[style]; pdev->pen_pattern = dash_patterns[style];
pdev->defer &= ~DEFER_PEN; pdev->defer &= ~DEFER_PEN;
break; break;
case PS_NULL: case PS_NULL:
pdev->pen_line = null_pen_line; pdev->pen_lines = null_pen_lines;
pdev->defer &= ~DEFER_PEN; pdev->defer &= ~DEFER_PEN;
break; break;
......
...@@ -136,7 +136,7 @@ typedef struct dibdrv_physdev ...@@ -136,7 +136,7 @@ typedef struct dibdrv_physdev
DWORD pen_color, pen_and, pen_xor; DWORD pen_color, pen_and, pen_xor;
dash_pattern pen_pattern; dash_pattern pen_pattern;
dash_pos dash_pos; dash_pos dash_pos;
BOOL (* pen_line)(struct dibdrv_physdev *pdev, POINT *start, POINT *end); BOOL (* pen_lines)(struct dibdrv_physdev *pdev, int num, POINT *pts);
/* brush */ /* brush */
UINT brush_style; UINT brush_style;
......
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