Yet another improvement to the bezier code.
This commit is contained in:
parent
d62c62b19b
commit
8077f1094b
|
@ -976,10 +976,20 @@ static BOOL32 BezierCheck( int level, POINT32 *Points)
|
||||||
INT32 dx, dy;
|
INT32 dx, dy;
|
||||||
dx=Points[3].x-Points[0].x;
|
dx=Points[3].x-Points[0].x;
|
||||||
dy=Points[3].y-Points[0].y;
|
dy=Points[3].y-Points[0].y;
|
||||||
if(ABS(dy)<ABS(dx)){/* shallow line */
|
if(ABS(dy)<=ABS(dx)){/* shallow line */
|
||||||
/* check that control points are between begin and end */
|
/* check that control points are between begin and end */
|
||||||
if( (Points[1].x-Points[0].x)*dx < 0 ||
|
if(Points[1].x < Points[0].x){
|
||||||
(Points[2].x-Points[0].x)*dx < 0 ) return FALSE;
|
if(Points[1].x < Points[3].x)
|
||||||
|
return FALSE;
|
||||||
|
}else
|
||||||
|
if(Points[1].x > Points[3].x)
|
||||||
|
return FALSE;
|
||||||
|
if(Points[2].x < Points[0].x){
|
||||||
|
if(Points[2].x < Points[3].x)
|
||||||
|
return FALSE;
|
||||||
|
}else
|
||||||
|
if(Points[2].x > Points[3].x)
|
||||||
|
return FALSE;
|
||||||
dx=BEZIERSHIFTDOWN(dx);
|
dx=BEZIERSHIFTDOWN(dx);
|
||||||
if(!dx) return TRUE;
|
if(!dx) return TRUE;
|
||||||
if(abs(Points[1].y-Points[0].y-(dy/dx)*
|
if(abs(Points[1].y-Points[0].y-(dy/dx)*
|
||||||
|
@ -991,8 +1001,18 @@ static BOOL32 BezierCheck( int level, POINT32 *Points)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}else{ /* steep line */
|
}else{ /* steep line */
|
||||||
/* check that control points are between begin and end */
|
/* check that control points are between begin and end */
|
||||||
if( (Points[1].y-Points[0].y)*dy < 0 ||
|
if(Points[1].y < Points[0].y){
|
||||||
(Points[2].y-Points[0].y)*dy < 0 ) return FALSE;
|
if(Points[1].y < Points[3].y)
|
||||||
|
return FALSE;
|
||||||
|
}else
|
||||||
|
if(Points[1].y > Points[3].y)
|
||||||
|
return FALSE;
|
||||||
|
if(Points[2].y < Points[0].y){
|
||||||
|
if(Points[2].y < Points[3].y)
|
||||||
|
return FALSE;
|
||||||
|
}else
|
||||||
|
if(Points[2].y > Points[3].y)
|
||||||
|
return FALSE;
|
||||||
dy=BEZIERSHIFTDOWN(dy);
|
dy=BEZIERSHIFTDOWN(dy);
|
||||||
if(!dy) return TRUE;
|
if(!dy) return TRUE;
|
||||||
if(abs(Points[1].x-Points[0].x-(dx/dy)*
|
if(abs(Points[1].x-Points[0].x-(dx/dy)*
|
||||||
|
|
Loading…
Reference in New Issue