Huw Davies : gdi32: Move to using a multi-line pen object-level function.
Alexandre Julliard
julliard at winehq.org
Mon Aug 22 13:29:11 CDT 2011
Module: wine
Branch: master
Commit: 0f40ad8a3d5a968234dc04976b55f4e62125ca67
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0f40ad8a3d5a968234dc04976b55f4e62125ca67
Author: Huw Davies <huw at codeweavers.com>
Date: Fri Aug 19 16:26:18 2011 +0100
gdi32: Move to using a multi-line pen object-level function.
---
dlls/gdi32/dibdrv/graphics.c | 10 ++++------
dlls/gdi32/dibdrv/objects.c | 32 ++++++++++++++++++++++++++++----
dlls/gdi32/gdi_private.h | 2 +-
3 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c
index a7a2fd8..ff83d1a 100644
--- a/dlls/gdi32/dibdrv/graphics.c
+++ b/dlls/gdi32/dibdrv/graphics.c
@@ -73,7 +73,7 @@ BOOL dibdrv_LineTo( PHYSDEV dev, INT x, INT y )
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 TRUE;
@@ -154,7 +154,7 @@ BOOL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
PHYSDEV next = GET_NEXT_PHYSDEV( dev, pRectangle );
dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
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);
@@ -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[1].x = pts[2].x = rect.left;
pts[2].y = pts[3].y = rect.bottom - 1;
+ pts[4] = pts[0];
- pdev->pen_line(pdev, pts , pts + 1);
- pdev->pen_line(pdev, pts + 1, pts + 2);
- pdev->pen_line(pdev, pts + 2, pts + 3);
- pdev->pen_line(pdev, pts + 3, pts );
+ pdev->pen_lines(pdev, 5, pts);
/* FIXME: Will need updating when we support wide pens */
diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c
index d96f4bd..e0e37f7 100644
--- a/dlls/gdi32/dibdrv/objects.c
+++ b/dlls/gdi32/dibdrv/objects.c
@@ -647,6 +647,18 @@ static BOOL solid_pen_line(dibdrv_physdev *pdev, POINT *start, POINT *end)
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)
{
pdev->dash_pos.cur_dash = 0;
@@ -920,7 +932,19 @@ static BOOL dashed_pen_line(dibdrv_physdev *pdev, POINT *start, POINT *end)
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;
}
@@ -984,7 +1008,7 @@ HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen )
case PS_SOLID:
if(logpen.lopnStyle & PS_GEOMETRIC) break;
if(logpen.lopnWidth.x > 1) break;
- pdev->pen_line = solid_pen_line;
+ pdev->pen_lines = solid_pen_lines;
pdev->defer &= ~DEFER_PEN;
break;
@@ -994,13 +1018,13 @@ HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen )
case PS_DASHDOTDOT:
if(logpen.lopnStyle & PS_GEOMETRIC) 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->defer &= ~DEFER_PEN;
break;
case PS_NULL:
- pdev->pen_line = null_pen_line;
+ pdev->pen_lines = null_pen_lines;
pdev->defer &= ~DEFER_PEN;
break;
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index f3ba2cf..40271af 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -136,7 +136,7 @@ typedef struct dibdrv_physdev
DWORD pen_color, pen_and, pen_xor;
dash_pattern pen_pattern;
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 */
UINT brush_style;
More information about the wine-cvs
mailing list