From 40dac11360c0d6d130f833b87828eabec012b8f2 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 9 Oct 2014 00:58:14 -0400 Subject: [PATCH] [base] Fix Savannah bug #43356. * src/base/ftbbox.c (BBox_Move_To, BBox_Conic_To): Update bbox in case of implicit `to'. (BBox_Line_To): New emitter that does not update bbox. --- ChangeLog | 8 ++++++++ src/base/ftbbox.c | 46 +++++++++++++++++++++++++++++++++++++++------- 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5b8a680c6..85c5d8583 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-10-08 Alexei Podtelezhnikov + + [base] Fix Savannah bug #43356. + + * src/base/ftbbox.c (BBox_Move_To, BBox_Conic_To): Update bbox in case + of implicit `to'. + (BBox_Line_To): New emitter that does not update bbox. + 2014-10-08 Alexei Podtelezhnikov [base] Introduce and use new macro `FT_UPDATE_BBOX' diff --git a/src/base/ftbbox.c b/src/base/ftbbox.c index e400e250d..91e1e811a 100644 --- a/src/base/ftbbox.c +++ b/src/base/ftbbox.c @@ -4,7 +4,7 @@ /* */ /* FreeType bbox computation (body). */ /* */ -/* Copyright 1996-2002, 2004, 2006, 2010, 2013 by */ +/* Copyright 1996-2002, 2004, 2006, 2010, 2013, 2014 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ @@ -67,10 +67,10 @@ /* BBox_Move_To */ /* */ /* */ - /* This function is used as a `move_to' and `line_to' emitter during */ + /* This function is used as a `move_to' emitter during */ /* FT_Outline_Decompose(). It simply records the destination point */ - /* in `user->last'; no further computations are necessary since we */ - /* use the cbox as the starting bbox which must be refined. */ + /* in `user->last'. We also update bbox in case contour starts with */ + /* an implicit `on' point. */ /* */ /* */ /* to :: A pointer to the destination vector. */ @@ -84,6 +84,38 @@ static int BBox_Move_To( FT_Vector* to, TBBox_Rec* user ) + { + FT_UPDATE_BBOX( to, user->bbox ); + + user->last = *to; + + return 0; + } + + + /*************************************************************************/ + /* */ + /* */ + /* BBox_Line_To */ + /* */ + /* */ + /* This function is used as a `line_to' emitter during */ + /* FT_Outline_Decompose(). It simply records the destination point */ + /* in `user->last'; no further computations are necessary because */ + /* bbox already contains both explicit ends of the line segment. */ + /* */ + /* */ + /* to :: A pointer to the destination vector. */ + /* */ + /* */ + /* user :: A pointer to the current walk context. */ + /* */ + /* */ + /* Always 0. Needed for the interface only. */ + /* */ + static int + BBox_Line_To( FT_Vector* to, + TBBox_Rec* user ) { user->last = *to; @@ -167,8 +199,8 @@ FT_Vector* to, TBBox_Rec* user ) { - /* we don't need to check `to' since it is always an `on' point, thus */ - /* within the bbox */ + /* in case `to' is implicit and not included in bbox yet */ + FT_UPDATE_BBOX( to, user->bbox ); if ( CHECK_X( control, user->bbox ) ) BBox_Conic_Check( user->last.x, @@ -389,7 +421,7 @@ FT_DEFINE_OUTLINE_FUNCS(bbox_interface, (FT_Outline_MoveTo_Func) BBox_Move_To, - (FT_Outline_LineTo_Func) BBox_Move_To, + (FT_Outline_LineTo_Func) BBox_Line_To, (FT_Outline_ConicTo_Func)BBox_Conic_To, (FT_Outline_CubicTo_Func)BBox_Cubic_To, 0, 0