Commit f33b237c961c41c8bda3fb2dfbc3bc71f9cfabc4

Michael Zucchi 2009-06-08T17:12:40

Handle FT_STROKER_LINECAP_BUTT. This fixes Savannah bug #26757. * src/base/ftstroke.c (ft_stroker_cap): Implement it.

diff --git a/ChangeLog b/ChangeLog
index 6491293..36b6210 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-06-08  Michael Zucchi  <notzed@gmail.com>
+
+	Handle FT_STROKER_LINECAP_BUTT.
+	This fixes Savannah bug #26757.
+
+	* src/base/ftstroke.c (ft_stroker_cap): Implement it.
+
 2009-06-07  Harald Fernengel  <harry@kdevelop.org>
 
 	Fix some potential out-of-memory crashes.
diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c
index eb7e57d..0978b0e 100644
--- a/src/base/ftstroke.c
+++ b/src/base/ftstroke.c
@@ -859,6 +859,31 @@
 
       error = ft_stroke_border_lineto( border, &delta, FALSE );
     }
+    else if ( stroker->line_cap == FT_STROKER_LINECAP_BUTT )
+    {
+      /* add a butt ending */
+      FT_Vector        delta;
+      FT_Angle         rotate = FT_SIDE_TO_ROTATE( side );
+      FT_Fixed         radius = stroker->radius;
+      FT_StrokeBorder  border = stroker->borders + side;
+
+
+      FT_Vector_From_Polar( &delta, radius, angle + rotate );
+
+      delta.x += stroker->center.x;
+      delta.y += stroker->center.y;
+
+      error = ft_stroke_border_lineto( border, &delta, FALSE );
+      if ( error )
+        goto Exit;
+
+      FT_Vector_From_Polar( &delta, radius, angle - rotate );
+
+      delta.x += stroker->center.x;
+      delta.y += stroker->center.y;
+
+      error = ft_stroke_border_lineto( border, &delta, FALSE );   
+    }
 
   Exit:
     return error;