Evan Stade : gdiplus: Changed the way the direction of the endcap is calculated to make LineCapArrowAnchor direction match Windows better .

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jul 12 08:32:45 CDT 2007


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

Author: Evan Stade <estade at gmail.com>
Date:   Wed Jul 11 18:08:26 2007 -0700

gdiplus: Changed the way the direction of the endcap is calculated to make LineCapArrowAnchor direction match Windows better.

---

 dlls/gdiplus/graphics.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 93cbcd1..eb37995 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -384,8 +384,13 @@ static GpStatus draw_polybezier(HDC hdc, GpPen *pen, GDIPCONST GpPointF * pt,
         if(pen->endcap == LineCapArrowAnchor)
             shorten_bezier_amt(ptf, pen->width);
 
-        draw_cap(hdc, pen->color, pen->endcap, pen->width, ptf[3].X,
-            ptf[3].Y, pt[count - 1].X, pt[count - 1].Y);
+        /* the direction of the line cap is parallel to the direction at the
+         * end of the bezier (which, if it has been shortened, is not the same
+         * as the direction from pt[count-2] to pt[count-1]) */
+        draw_cap(hdc, pen->color, pen->endcap, pen->width,
+            pt[count - 1].X - (ptf[3].X - ptf[2].X),
+            pt[count - 1].Y - (ptf[3].Y - ptf[2].Y),
+            pt[count - 1].X, pt[count - 1].Y);
     }
 
     for(i = 0; i < count - 4; i ++){
@@ -474,8 +479,10 @@ static GpStatus draw_poly(HDC hdc, GpPen *pen, GDIPCONST GpPointF * pt,
             if(pen->endcap == LineCapArrowAnchor)
                 shorten_bezier_amt(ptf, pen->width);
 
-            draw_cap(hdc, pen->color, pen->endcap, pen->width, ptf[3].X,
-                ptf[3].Y, pt[count - 1].X, pt[count - 1].Y);
+            draw_cap(hdc, pen->color, pen->endcap, pen->width,
+                pt[count - 1].X - (ptf[3].X - ptf[2].X),
+                pt[count - 1].Y - (ptf[3].Y - ptf[2].Y),
+                pt[count - 1].X, pt[count - 1].Y);
         }
         for(i = 0; i < 4; i ++){
             pti[i + count - 4].x = roundr(ptf[i].X);




More information about the wine-cvs mailing list