[base] Introduce and use new macro `FT_UPDATE_BBOX'

* src/base/ftbbox.c (FT_UPDATE_BBOX): New macro.
(FT_Outline_Get_BBox): Use it here.
This commit is contained in:
Alexei Podtelezhnikov 2014-10-08 22:01:08 -04:00
parent 7abdb8ccea
commit 2ffcf17e15
2 changed files with 28 additions and 25 deletions

View File

@ -1,3 +1,10 @@
2014-10-08 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Introduce and use new macro `FT_UPDATE_BBOX'
* src/base/ftbbox.c (FT_UPDATE_BBOX): New macro.
(FT_Outline_Get_BBox): Use it here.
2014-10-02 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Significant optimization of `ft_div64by32'

View File

@ -42,6 +42,25 @@
} 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; \
FT_END_STMNT
#define CHECK_X( p, bbox ) \
( p->x < bbox.xMin || p->x > bbox.xMax )
#define CHECK_Y( p, bbox ) \
( p->y < bbox.yMin || p->y > bbox.yMax )
/*************************************************************************/
/* */
/* <Function> */
@ -72,13 +91,6 @@
}
#define CHECK_X( p, bbox ) \
( p->x < bbox.xMin || p->x > bbox.xMax )
#define CHECK_Y( p, bbox ) \
( p->y < bbox.yMin || p->y > bbox.yMax )
/*************************************************************************/
/* */
/* <Function> */
@ -420,26 +432,10 @@ FT_DEFINE_OUTLINE_FUNCS(bbox_interface,
for ( n = 1; n < outline->n_points; n++ )
{
FT_Pos x = vec->x;
FT_Pos y = vec->y;
/* update control box */
if ( x < cbox.xMin ) cbox.xMin = x;
if ( x > cbox.xMax ) cbox.xMax = x;
if ( y < cbox.yMin ) cbox.yMin = y;
if ( y > cbox.yMax ) cbox.yMax = y;
FT_UPDATE_BBOX( vec, cbox);
if ( FT_CURVE_TAG( outline->tags[n] ) == FT_CURVE_TAG_ON )
{
/* update bbox for `on' points only */
if ( x < bbox.xMin ) bbox.xMin = x;
if ( x > bbox.xMax ) bbox.xMax = x;
if ( y < bbox.yMin ) bbox.yMin = y;
if ( y > bbox.yMax ) bbox.yMax = y;
}
FT_UPDATE_BBOX( vec, bbox);
vec++;
}