Evan Stade : gdiplus: Better handle UnitPixel pen width.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Aug 14 07:12:59 CDT 2007


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

Author: Evan Stade <estade at gmail.com>
Date:   Mon Aug 13 18:34:31 2007 -0700

gdiplus: Better handle UnitPixel pen width.

---

 dlls/gdiplus/graphics.c |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 1d2748a..fecabfb 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -92,18 +92,23 @@ static INT prepare_dc(GpGraphics *graphics, GpPen *pen)
 
     EndPath(graphics->hdc);
 
-    /* Get an estimate for the amount the pen width is affected by the world
-     * transform. (This is similar to what some of the wine drivers do.) */
-    pt[0].X = 0.0;
-    pt[0].Y = 0.0;
-    pt[1].X = 1.0;
-    pt[1].Y = 1.0;
-    GdipTransformMatrixPoints(graphics->worldtrans, pt, 2);
-    width = sqrt((pt[1].X - pt[0].X) * (pt[1].X - pt[0].X) +
-                 (pt[1].Y - pt[0].Y) * (pt[1].Y - pt[0].Y)) / sqrt(2.0);
-
-    width *= pen->width * convert_unit(graphics->hdc,
-                          pen->unit == UnitWorld ? graphics->unit : pen->unit);
+    if(pen->unit == UnitPixel){
+        width = pen->width;
+    }
+    else{
+        /* Get an estimate for the amount the pen width is affected by the world
+         * transform. (This is similar to what some of the wine drivers do.) */
+        pt[0].X = 0.0;
+        pt[0].Y = 0.0;
+        pt[1].X = 1.0;
+        pt[1].Y = 1.0;
+        GdipTransformMatrixPoints(graphics->worldtrans, pt, 2);
+        width = sqrt((pt[1].X - pt[0].X) * (pt[1].X - pt[0].X) +
+                     (pt[1].Y - pt[0].Y) * (pt[1].Y - pt[0].Y)) / sqrt(2.0);
+
+        width *= pen->width * convert_unit(graphics->hdc,
+                              pen->unit == UnitWorld ? graphics->unit : pen->unit);
+    }
 
     if(pen->dash == DashStyleCustom){
         numdashes = min(pen->numdashes, MAX_DASHLEN);




More information about the wine-cvs mailing list