summaryrefslogtreecommitdiff
path: root/third_party/freetype/src/base/ftbbox.c
diff options
context:
space:
mode:
authorOliver Chang <ochang@chromium.org>2015-11-05 16:00:40 -0800
committerOliver Chang <ochang@chromium.org>2015-11-05 16:00:40 -0800
commitcec3f6878e37fcd1c6c15e0e2ab011931d55549e (patch)
treefb3a01b9b966e59f8851ea4438243b1813a951e7 /third_party/freetype/src/base/ftbbox.c
parentcca5b7684f48e2e933bf08ed573f7caca8e1d1ad (diff)
downloadpdfium-cec3f6878e37fcd1c6c15e0e2ab011931d55549e.tar.xz
Merge to XFA: Update bundled freetype to 2.6.1
Also adds a README.pdfium and 0000-include.patch that details the local modifications made. Also rolls testing/corpus to 45f88c6914fcac26ad930bb0ebbfa468c21db0a5 which includes regenerated corpus expectations. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1413673003 . (cherry picked from commit 87ee069d05ca06f60d6cfacd9e426739d8f2053d) Review URL: https://codereview.chromium.org/1416993005 .
Diffstat (limited to 'third_party/freetype/src/base/ftbbox.c')
-rw-r--r--third_party/freetype/src/base/ftbbox.c43
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;