fix pathops quad line intersection
git-svn-id: http://skia.googlecode.com/svn/trunk@12374 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
27346f52cb
commit
28d219c568
@ -304,15 +304,10 @@ protected:
|
||||
SkDPoint xy = fQuad.ptAtT(t);
|
||||
double dx = fLine[1].fX - fLine[0].fX;
|
||||
double dy = fLine[1].fY - fLine[0].fY;
|
||||
double dxT = (xy.fX - fLine[0].fX) / dx;
|
||||
double dyT = (xy.fY - fLine[0].fY) / dy;
|
||||
if (!between(FLT_EPSILON, dxT, 1 - FLT_EPSILON) && between(0, dyT, 1)) {
|
||||
return dyT;
|
||||
if (fabs(dx) > fabs(dy)) {
|
||||
return (xy.fX - fLine[0].fX) / dx;
|
||||
}
|
||||
if (!between(FLT_EPSILON, dyT, 1 - FLT_EPSILON) && between(0, dxT, 1)) {
|
||||
return dxT;
|
||||
}
|
||||
return fabs(dx) > fabs(dy) ? dxT : dyT;
|
||||
return (xy.fY - fLine[0].fY) / dy;
|
||||
}
|
||||
|
||||
bool pinTs(double* quadT, double* lineT, SkDPoint* pt, PinTPoint ptSet) {
|
||||
|
@ -3946,9 +3946,23 @@ static void testQuad10(skiatest::Reporter* reporter) {
|
||||
testSimplify(reporter, path);
|
||||
}
|
||||
|
||||
static void testQuad11(skiatest::Reporter* reporter) {
|
||||
SkPath path;
|
||||
path.moveTo(2, 0);
|
||||
path.quadTo(0, 1, 1, 2);
|
||||
path.lineTo(1, 2);
|
||||
path.close();
|
||||
path.moveTo(0, 0);
|
||||
path.lineTo(1, 1);
|
||||
path.quadTo(1, 3, 3, 3);
|
||||
path.close();
|
||||
testSimplify(reporter, path);
|
||||
}
|
||||
|
||||
static void (*firstTest)(skiatest::Reporter* ) = 0;
|
||||
|
||||
static TestDesc tests[] = {
|
||||
TEST(testQuad11),
|
||||
TEST(testQuad10),
|
||||
TEST(testQuad9),
|
||||
TEST(testTriangles4x),
|
||||
|
Loading…
Reference in New Issue
Block a user