Alexandre Julliard : gdi32: Add support for 1-pixel wide PS_USERSTYLE pens.
Alexandre Julliard
julliard at winehq.org
Wed Dec 28 13:44:33 CST 2011
Module: wine
Branch: master
Commit: f155db574f3c086a03f6876e016075b97064dcf6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f155db574f3c086a03f6876e016075b97064dcf6
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Dec 28 17:41:15 2011 +0100
gdi32: Add support for 1-pixel wide PS_USERSTYLE pens.
---
dlls/gdi32/dibdrv/objects.c | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c
index ab0dd87..46f3092 100644
--- a/dlls/gdi32/dibdrv/objects.c
+++ b/dlls/gdi32/dibdrv/objects.c
@@ -1253,6 +1253,24 @@ static const dash_pattern dash_patterns_geometric[4] =
{6, {3, 1, 1, 1, 1, 1}, 8} /* PS_DASHDOTDOT */
};
+static inline void set_dash_pattern( dash_pattern *pattern, DWORD count, DWORD *dashes )
+{
+ DWORD i;
+
+ pattern->count = count;
+ pattern->total_len = 0;
+ memcpy( pattern->dashes, dashes, count * sizeof(DWORD) );
+ for (i = 0; i < count; i++) pattern->total_len += dashes[i];
+ if (pattern->count % 2) pattern->total_len *= 2;
+}
+
+static inline void scale_dash_pattern( dash_pattern *pattern, DWORD scale )
+{
+ DWORD i;
+ for (i = 0; i < pattern->count; i++) pattern->dashes[i] *= scale;
+ pattern->total_len *= scale;
+}
+
static inline int get_pen_device_width( dibdrv_physdev *pdev, int width )
{
POINT pts[2];
@@ -1303,7 +1321,7 @@ HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen )
logpen.lopnColor = GetDCPenColor( dev->hdc );
pdev->pen_colorref = logpen.lopnColor;
- memset( &pdev->pen_pattern, 0, sizeof(pdev->pen_pattern) );
+ set_dash_pattern( &pdev->pen_pattern, 0, NULL );
pdev->defer |= DEFER_PEN;
@@ -1351,6 +1369,14 @@ HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen )
pdev->defer &= ~DEFER_PEN;
break;
+ case PS_USERSTYLE:
+ if (pdev->pen_width > 1) break; /* not supported yet */
+ pdev->pen_lines = dashed_pen_lines;
+ set_dash_pattern( &pdev->pen_pattern, elp->elpNumEntries, elp->elpStyleEntry );
+ if (!(logpen.lopnStyle & PS_GEOMETRIC)) scale_dash_pattern( &pdev->pen_pattern, 3 );
+ pdev->defer &= ~DEFER_PEN;
+ break;
+
default:
break;
}
More information about the wine-cvs
mailing list