forked from minhngoc25a/freetype2
[base] Refactor experimental (disabled) BBox_Cubic_Check.
* src/base/ftbbox.c (BBox_Cubic_Check): Implement the minimum search as the mirror image of the maximum search.
This commit is contained in:
parent
9bcfab8758
commit
61a65510dc
|
@ -1,3 +1,10 @@
|
||||||
|
2013-08-13 Alexei Podtelezhnikov <apodtele@gmail.com>
|
||||||
|
|
||||||
|
[base] Refactor experimental (disabled) BBox_Cubic_Check.
|
||||||
|
|
||||||
|
* src/base/ftbbox.c (BBox_Cubic_Check): Implement the minimum search
|
||||||
|
as the mirror image of the maximum search.
|
||||||
|
|
||||||
2013-08-06 John Tytgat <John.Tytgat@esko.com>
|
2013-08-06 John Tytgat <John.Tytgat@esko.com>
|
||||||
|
|
||||||
Fix Savannah bug #39702.
|
Fix Savannah bug #39702.
|
||||||
|
|
|
@ -216,25 +216,16 @@
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
static void
|
static FT_Pos
|
||||||
BBox_Cubic_Check( FT_Pos p1,
|
update_max( FT_Pos q1,
|
||||||
FT_Pos p2,
|
FT_Pos q2,
|
||||||
FT_Pos p3,
|
FT_Pos q3,
|
||||||
FT_Pos p4,
|
FT_Pos q4,
|
||||||
FT_Pos* min,
|
FT_Pos max )
|
||||||
FT_Pos* max )
|
|
||||||
{
|
{
|
||||||
FT_Pos q1, q2, q3, q4;
|
|
||||||
|
|
||||||
|
|
||||||
q1 = p1;
|
|
||||||
q2 = p2;
|
|
||||||
q3 = p3;
|
|
||||||
q4 = p4;
|
|
||||||
|
|
||||||
/* for a conic segment to possibly reach new maximum */
|
/* for a conic segment to possibly reach new maximum */
|
||||||
/* one of its off-points must be above the current value */
|
/* one of its off-points must be above the current value */
|
||||||
while ( q2 > *max || q3 > *max )
|
while ( q2 > max || q3 > max )
|
||||||
{
|
{
|
||||||
/* determine which half contains the maximum and split */
|
/* determine which half contains the maximum and split */
|
||||||
if ( q1 + q2 > q3 + q4 ) /* first half */
|
if ( q1 + q2 > q3 + q4 ) /* first half */
|
||||||
|
@ -263,61 +254,31 @@
|
||||||
/* check if either end reached the maximum */
|
/* check if either end reached the maximum */
|
||||||
if ( q1 == q2 && q1 >= q3 )
|
if ( q1 == q2 && q1 >= q3 )
|
||||||
{
|
{
|
||||||
*max = q1;
|
max = q1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ( q3 == q4 && q2 <= q4 )
|
if ( q3 == q4 && q2 <= q4 )
|
||||||
{
|
{
|
||||||
*max = q4;
|
max = q4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
q1 = p1;
|
return max;
|
||||||
q2 = p2;
|
}
|
||||||
q3 = p3;
|
|
||||||
q4 = p4;
|
|
||||||
|
|
||||||
/* for a conic segment to possibly reach new minimum */
|
static void
|
||||||
/* one of its off-points must be below the current value */
|
BBox_Cubic_Check( FT_Pos p1,
|
||||||
while ( q2 < *min || q3 < *min )
|
FT_Pos p2,
|
||||||
{
|
FT_Pos p3,
|
||||||
/* determine which half contains the minimum and split */
|
FT_Pos p4,
|
||||||
if ( q1 + q2 < q3 + q4 ) /* first half */
|
FT_Pos* min,
|
||||||
{
|
FT_Pos* max )
|
||||||
q4 = q4 + q3;
|
{
|
||||||
q3 = q3 + q2;
|
*max = update_max( p1, p2, p3, p4, *max );
|
||||||
q2 = q2 + q1;
|
|
||||||
q4 = q4 + q3;
|
|
||||||
q3 = q3 + q2;
|
|
||||||
q4 = ( q4 + q3 ) / 8;
|
|
||||||
q3 = q3 / 4;
|
|
||||||
q2 = q2 / 2;
|
|
||||||
}
|
|
||||||
else /* second half */
|
|
||||||
{
|
|
||||||
q1 = q1 + q2;
|
|
||||||
q2 = q2 + q3;
|
|
||||||
q3 = q3 + q4;
|
|
||||||
q1 = q1 + q2;
|
|
||||||
q2 = q2 + q3;
|
|
||||||
q1 = ( q1 + q2 ) / 8;
|
|
||||||
q2 = q2 / 4;
|
|
||||||
q3 = q3 / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check if either end reached the minimum */
|
/* now flip the signs to update the minimum */
|
||||||
if ( q1 == q2 && q1 <= q3 )
|
*min = -update_max( -p1, -p2, -p3, -p4, -*min );
|
||||||
{
|
|
||||||
*min = q1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ( q3 == q4 && q2 >= q4 )
|
|
||||||
{
|
|
||||||
*min = q4;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue