From f33b237c961c41c8bda3fb2dfbc3bc71f9cfabc4 Mon Sep 17 00:00:00 2001 From: Michael Zucchi Date: Mon, 8 Jun 2009 17:12:40 +0200 Subject: [PATCH] Handle FT_STROKER_LINECAP_BUTT. This fixes Savannah bug #26757. * src/base/ftstroke.c (ft_stroker_cap): Implement it. --- ChangeLog | 7 +++++++ src/base/ftstroke.c | 25 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/ChangeLog b/ChangeLog index 649129362..36b621027 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-06-08 Michael Zucchi + + Handle FT_STROKER_LINECAP_BUTT. + This fixes Savannah bug #26757. + + * src/base/ftstroke.c (ft_stroker_cap): Implement it. + 2009-06-07 Harald Fernengel Fix some potential out-of-memory crashes. diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c index eb7e57d29..0978b0ed9 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;