diff --git a/ChangeLog b/ChangeLog index 7cc14dfa6..03ac4d700 100644 --- a/ChangeLog +++ b/ChangeLog @@ -201,10 +201,11 @@ 2013-08-19 Alexei Podtelezhnikov - [base] Enable new algorithm for BBox_Cubic_Check. + [base] Enable new algorithm for `BBox_Cubic_Check'. - * src/base/ftbbox.c: Enable new BBox_Cubic_Check algorithm, remove the - old one. Improve comments. + * src/base/ftbbox.c: Enable new BBox_Cubic_Check algorithm, remove + the old one. + Improve comments. 2013-08-18 Werner Lemberg diff --git a/src/base/ftbbox.c b/src/base/ftbbox.c index ebbfb1a8f..8d3f383b4 100644 --- a/src/base/ftbbox.c +++ b/src/base/ftbbox.c @@ -85,7 +85,7 @@ /* BBox_Conic_Check */ /* */ /* */ - /* Finds the extrema of a 1-dimensional conic Bezier curve and update */ + /* Find the extrema of a 1-dimensional conic Bezier curve and update */ /* a bounding range. This version uses direct computation, as it */ /* doesn't need square roots. */ /* */ @@ -108,10 +108,10 @@ FT_Pos* min, FT_Pos* max ) { - /* This function is only called when a control off-point is outside */ - /* the bbox that contains all on-points. It finds a local extremum */ - /* within the segment, equal to (y1*y3 - y2*y2)/(y1 - 2*y2 + y3). */ - /* Or, offsetting from y2, we get */ + /* This function is only called when a control off-point is outside */ + /* the bbox that contains all on-points. It finds a local extremum */ + /* within the segment, equal to (y1*y3 - y2*y2)/(y1 - 2*y2 + y3). */ + /* Or, offsetting from y2, we get */ y1 -= y2; y3 -= y2; @@ -184,8 +184,8 @@ /* BBox_Cubic_Check */ /* */ /* */ - /* Finds the extrema of a 1-dimensional cubic Bezier curve and */ - /* updates a bounding range. This version uses iterative splitting */ + /* Find the extrema of a 1-dimensional cubic Bezier curve and */ + /* update a bounding range. This version uses iterative splitting */ /* because it is faster than the exact solution with square roots. */ /* */ /* */ @@ -202,13 +202,12 @@ /* */ /* max :: The address of the current maximum. */ /* */ - static FT_Pos - update_cubic_max( FT_Pos q1, - FT_Pos q2, - FT_Pos q3, - FT_Pos q4, - FT_Pos max ) + update_cubic_max( FT_Pos q1, + FT_Pos q2, + FT_Pos q3, + FT_Pos q4, + FT_Pos max ) { /* for a cubic segment to possibly reach new maximum, at least */ /* one of its off-points must stay above the current value */ @@ -238,7 +237,7 @@ q3 = q3 / 2; } - /* check if either end reached the maximum */ + /* check whether either end reached the maximum */ if ( q1 == q2 && q1 >= q3 ) { max = q1; @@ -254,6 +253,7 @@ return max; } + static void BBox_Cubic_Check( FT_Pos p1, FT_Pos p2, @@ -262,16 +262,17 @@ FT_Pos* min, FT_Pos* max ) { - FT_Pos nmin, nmax; - FT_Int shift; + FT_Pos nmin, nmax; + FT_Int shift; + /* This function is only called when a control off-point is outside */ - /* the bbox that contains all on-points. It finds a local extremum */ + /* the bbox that contains all on-points. It finds a local extremum */ /* within the segment using iterative bisection of the segment. */ - /* The fixed-point arithmentic of bisection is inherently stable */ - /* but may loose accuracy in the two lowest bits. To compensate, */ - /* we upscale the segment if there is room. Large values may need */ - /* to be downscaled to avoid overflows during bisection bisection. */ + /* The fixed-point arithmetic of bisection is inherently stable */ + /* but may loose accuracy in the two lowest bits. To compensate, */ + /* we upscale the segment if there is room. Large values may need */ + /* to be downscaled to avoid overflows during bisection. */ /* The control off-point outside the bbox is likely to have the top */ /* absolute value among arguments. */ @@ -357,9 +358,9 @@ FT_Vector* to, TBBox_Rec* user ) { - /* We don't need to check `to' since it is always an on-point, */ - /* thus within the bbox. Only segments with an off-point outside */ - /* the bbox can possibly reach new extreme values. */ + /* We don't need to check `to' since it is always an on-point, */ + /* thus within the bbox. Only segments with an off-point outside */ + /* the bbox can possibly reach new extreme values. */ if ( CHECK_X( control1, user->bbox ) || CHECK_X( control2, user->bbox ) )