From f68cfd096f210890422417a08e8c8b1799b4146a Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 14 Jul 2004 21:30:34 +0000 Subject: [PATCH] * src/base/ftstroke (ft_stroke_border_reverse): Removed. Unused. --- ChangeLog | 33 ++++++++++++++------ src/base/ftstroke.c | 76 +++++++++------------------------------------ 2 files changed, 38 insertions(+), 71 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d486fa68..b5e4e5c7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,17 +1,32 @@ +2004-07-13 Werner Lemberg + + * src/base/ftstroke (ft_stroke_border_reverse): Removed. Unused. + 2004-07-12 David Turner - * src/base/ftstroke.c: last (?) bugfixes to the stroker. + * src/base/ftstroke.c (ft_stroke_border_close): Add second parameter + to indicate reversion of points. + Update all callers. + (ft_stroke_border_reverse): Fix initialization of `point1' and + `tag1'. - * src/cache/ftcsbits.c: fixing advance computation for - transformed glyphs + * src/cache/ftcsbits.c (ftc_snode_load): Fixing advance computation + for transformed glyphs. 2004-07-11 David Turner - * src/base/ftstroke.c: fixed a bug that prevented the stroker to - correctly generate stroked paths from closed paths, i.e. nearly - all glyphs in vectorial fonts :-) + Fix bugs that prevented the stroker to correctly generate stroked + paths from closed paths, i.e., nearly all glyphs in vectorial fonts. - The code is still _very_ buggy though, treat with special care. + The code is still _very_ buggy though; treat with special care. + + * src/base/ftstroke.c (FT_STROKE_TAG_BEGIN_END): New macro. + (ft_stroke_border_reverse): New function. + (ft_stroker_inside): Remove local variable `sigma'; use different + threshold. + (ft_stroker_add_reverse_left): Switch begin/end tags if necessary. + (FT_Stroker_EndSubPath): Call ft_stroker_inside and + ft_stroke_border_reverse. 2004-06-26 Peter Kovar @@ -24,8 +39,8 @@ 2004-06-24 David Turner - * src/truetype/ttgload.c, src/truetype/ttxgvar.c: removing - compiler warnings + * src/truetype/ttgload.c, src/truetype/ttxgvar.c: Removing + compiler warnings. 2004-06-23 Werner Lemberg diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c index e10e80f34..649fa8a83 100644 --- a/src/base/ftstroke.c +++ b/src/base/ftstroke.c @@ -286,6 +286,7 @@ FT_UInt start = border->start; FT_UInt count = border->num_points; + FT_ASSERT( border->start >= 0 ); /* don't record empty paths! */ @@ -293,40 +294,41 @@ border->num_points = start; else { - /* copy the last point to the start of this sub-path, since - * it contains the "adjusted" starting coordinates - */ + /* copy the last point to the start of this sub-path, since */ + /* it contains the `adjusted' starting coordinates */ border->num_points = --count; border->points[start] = border->points[count]; if ( reverse ) { - /* reverse the points - */ + /* reverse the points */ { FT_Vector* vec1 = border->points + start + 1; FT_Vector* vec2 = border->points + count - 1; + for ( ; vec1 < vec2; vec1++, vec2-- ) { FT_Vector tmp; + tmp = *vec1; *vec1 = *vec2; *vec2 = tmp; } } - /* then the tags - */ + /* then the tags */ { FT_Byte* tag1 = border->tags + start + 1; FT_Byte* tag2 = border->tags + count - 1; + for ( ; tag1 < tag2; tag1++, tag2-- ) { FT_Byte tmp; + tmp = *tag1; *tag1 = *tag2; *tag2 = tmp; @@ -334,8 +336,8 @@ } } - border->tags[ start ] |= FT_STROKE_TAG_BEGIN; - border->tags[ count - 1 ] |= FT_STROKE_TAG_END; + border->tags[start ] |= FT_STROKE_TAG_BEGIN; + border->tags[count - 1] |= FT_STROKE_TAG_END; } border->start = -1; @@ -674,54 +676,6 @@ } - static void - ft_stroke_border_reverse( FT_StrokeBorder border ) - { - FT_Vector* point1 = border->points + border->start + 1; - FT_Vector* point2 = border->points + border->num_points-1; - FT_Byte* tag1 = border->tags + border->start + 1; - FT_Byte* tag2 = border->tags + border->num_points-1; - - while ( point1 < point2 ) - { - FT_Vector tpoint; - FT_Byte ttag1, ttag2, ttag; - - /* swap the points - */ - tpoint = *point1; - *point1 = *point2; - *point2 = tpoint; - - /* swap the tags - */ - ttag1 = *tag1; - ttag2 = *tag2; - -#if 0 - ttag = ttag1 & FT_STROKE_TAG_BEGIN_END; - if ( ttag == FT_STROKE_TAG_BEGIN || - ttag == FT_STROKE_TAG_END ) - ttag1 ^= FT_STROKE_TAG_BEGIN_END; - - ttag = ttag2 & FT_STROKE_TAG_BEGIN_END; - if ( ttag == FT_STROKE_TAG_BEGIN || - ttag == FT_STROKE_TAG_END ) - ttag2 ^= FT_STROKE_TAG_BEGIN_END; -#endif - - *tag1 = ttag2; - *tag2 = ttag1; - - point1++; - point2--; - tag1++; - tag2--; - } - } - - - /***************************************************************************/ /***************************************************************************/ /***** *****/ @@ -919,8 +873,7 @@ thcos = FT_Cos( theta ); - /* TODO: find better criterion to switch off the optimisation - */ + /* TODO: find better criterion to switch off the optimization */ if ( thcos < 0x4000 ) { FT_Vector_From_Polar( &delta, stroker->radius, @@ -1453,12 +1406,11 @@ { FT_Byte ttag = dst_tag[0] & FT_STROKE_TAG_BEGIN_END; - /* switch begin/end tags if necessary.. */ + + /* switch begin/end tags if necessary */ if ( ttag == FT_STROKE_TAG_BEGIN || ttag == FT_STROKE_TAG_END ) - { dst_tag[0] ^= FT_STROKE_TAG_BEGIN_END; - } }