diff options
Diffstat (limited to 'third_party/freetype/src/base/ftbbox.c')
-rw-r--r-- | third_party/freetype/src/base/ftbbox.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/third_party/freetype/src/base/ftbbox.c b/third_party/freetype/src/base/ftbbox.c index c775d5c8cf..10df98de6a 100644 --- a/third_party/freetype/src/base/ftbbox.c +++ b/third_party/freetype/src/base/ftbbox.c @@ -4,7 +4,7 @@ /* */ /* FreeType bbox computation (body). */ /* */ -/* Copyright 1996-2002, 2004, 2006, 2010, 2013, 2014 by */ +/* Copyright 1996-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used */ @@ -42,22 +42,22 @@ } TBBox_Rec; -#define FT_UPDATE_BBOX(p, bbox) \ - FT_BEGIN_STMNT \ - if ( p->x < bbox.xMin ) \ - bbox.xMin = p->x; \ - if ( p->x > bbox.xMax ) \ - bbox.xMax = p->x; \ - if ( p->y < bbox.yMin ) \ - bbox.yMin = p->y; \ - if ( p->y > bbox.yMax ) \ - bbox.yMax = p->y; \ +#define FT_UPDATE_BBOX( p, bbox ) \ + FT_BEGIN_STMNT \ + if ( p->x < bbox.xMin ) \ + bbox.xMin = p->x; \ + if ( p->x > bbox.xMax ) \ + bbox.xMax = p->x; \ + if ( p->y < bbox.yMin ) \ + bbox.yMin = p->y; \ + if ( p->y > bbox.yMax ) \ + bbox.yMax = p->y; \ FT_END_STMNT -#define CHECK_X( p, bbox ) \ +#define CHECK_X( p, bbox ) \ ( p->x < bbox.xMin || p->x > bbox.xMax ) -#define CHECK_Y( p, bbox ) \ +#define CHECK_Y( p, bbox ) \ ( p->y < bbox.yMin || p->y > bbox.yMax ) @@ -255,6 +255,7 @@ FT_Pos peak = 0; FT_Int shift; + /* This function finds a peak of a cubic segment if it is above 0 */ /* using iterative bisection of the segment, or returns 0. */ /* The fixed-point arithmetic of bisection is inherently stable */ @@ -264,8 +265,10 @@ /* It is called with either q2 or q3 positive, which is necessary */ /* for the peak to exist and avoids undefined FT_MSB. */ - shift = 27 - - FT_MSB( FT_ABS( q1 ) | FT_ABS( q2 ) | FT_ABS( q3 ) | FT_ABS( q4 ) ); + shift = 27 - FT_MSB( (FT_UInt32)( FT_ABS( q1 ) | + FT_ABS( q2 ) | + FT_ABS( q3 ) | + FT_ABS( q4 ) ) ); if ( shift > 0 ) { @@ -419,7 +422,8 @@ return 0; } -FT_DEFINE_OUTLINE_FUNCS(bbox_interface, + + FT_DEFINE_OUTLINE_FUNCS(bbox_interface, (FT_Outline_MoveTo_Func) BBox_Move_To, (FT_Outline_LineTo_Func) BBox_Line_To, (FT_Outline_ConicTo_Func)BBox_Conic_To, @@ -427,14 +431,17 @@ FT_DEFINE_OUTLINE_FUNCS(bbox_interface, 0, 0 ) + /* documentation is in ftbbox.h */ FT_EXPORT_DEF( FT_Error ) FT_Outline_Get_BBox( FT_Outline* outline, FT_BBox *abbox ) { - FT_BBox cbox = { 0x7FFFFFFF, 0x7FFFFFFF, -0x7FFFFFFF, -0x7FFFFFFF }; - FT_BBox bbox = { 0x7FFFFFFF, 0x7FFFFFFF, -0x7FFFFFFF, -0x7FFFFFFF }; + FT_BBox cbox = { 0x7FFFFFFFL, 0x7FFFFFFFL, + -0x7FFFFFFFL, -0x7FFFFFFFL }; + FT_BBox bbox = { 0x7FFFFFFFL, 0x7FFFFFFFL, + -0x7FFFFFFFL, -0x7FFFFFFFL }; FT_Vector* vec; FT_UShort n; |