Alexandre Julliard : gdi32: Fix the scaling of the width of cosmetic pens.

Alexandre Julliard julliard at winehq.org
Wed Dec 28 13:44:33 CST 2011


Module: wine
Branch: master
Commit: ab63eb5c40d25bcbf2742f2dcb73df08a4301c2c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ab63eb5c40d25bcbf2742f2dcb73df08a4301c2c

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Dec 28 13:50:41 2011 +0100

gdi32: Fix the scaling of the width of cosmetic pens.

---

 dlls/gdi32/dibdrv/objects.c |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c
index e203af7..c9b7814 100644
--- a/dlls/gdi32/dibdrv/objects.c
+++ b/dlls/gdi32/dibdrv/objects.c
@@ -1245,18 +1245,15 @@ static const dash_pattern dash_patterns[5] =
     {6, {9, 3, 3, 3, 3, 3}, 24}   /* PS_DASHDOTDOT */
 };
 
-static inline int get_pen_device_width( dibdrv_physdev *pdev, LOGPEN *pen )
+static inline int get_pen_device_width( dibdrv_physdev *pdev, int width )
 {
-    int width = pen->lopnWidth.x;
+    POINT pts[2];
 
-    if (pen->lopnStyle & PS_GEOMETRIC && width > 1)
-    {
-        POINT pts[2];
-        pts[0].x = pts[0].y = pts[1].y = 0;
-        pts[1].x = width;
-        LPtoDP( pdev->dev.hdc, pts, 2 );
-        width = abs( pts[1].x - pts[0].x );
-    }
+    if (!width) return 1;
+    pts[0].x = pts[0].y = pts[1].y = 0;
+    pts[1].x = width;
+    LPtoDP( pdev->dev.hdc, pts, 2 );
+    width = abs( pts[1].x - pts[0].x );
     return max( width, 1 );
 }
 
@@ -1285,15 +1282,16 @@ HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen )
         /* FIXME: add support for user style pens */
         logpen.lopnStyle = elp->elpPenStyle;
         logpen.lopnWidth.x = elp->elpWidth;
-        logpen.lopnWidth.y = 0;
         logpen.lopnColor = elp->elpColor;
+        /* cosmetic ext pens are always 1-pixel wide */
+        if (!(logpen.lopnStyle & PS_GEOMETRIC)) logpen.lopnWidth.x = 0;
 
         HeapFree( GetProcessHeap(), 0, elp );
     }
 
     pdev->pen_join   = logpen.lopnStyle & PS_JOIN_MASK;
     pdev->pen_endcap = logpen.lopnStyle & PS_ENDCAP_MASK;
-    pdev->pen_width  = get_pen_device_width( pdev, &logpen );
+    pdev->pen_width  = get_pen_device_width( pdev, logpen.lopnWidth.x );
 
     if (hpen == GetStockObject( DC_PEN ))
         logpen.lopnColor = GetDCPenColor( dev->hdc );




More information about the wine-cvs mailing list