Fix mono quad winding (flutter/engine#21530)

This commit is contained in:
Ferhat
2020-10-01 13:51:38 -07:00
committed by GitHub
parent a22355b13b
commit 442181e3b2
2 changed files with 16 additions and 1 deletions

View File

@@ -146,7 +146,7 @@ class PathWinding {
_QuadRoots quadRoots = _QuadRoots();
final int n = quadRoots.findRoots(
startY - 2 * y1 + endY, 2 * (y1 - startY), endY - y);
startY - 2 * y1 + endY, 2 * (y1 - startY), startY - y);
assert(n <= 1);
double xt;
if (0 == n) {

View File

@@ -298,6 +298,7 @@ void testMain() {
}
}
});
test('Concave lines path', () {
final SurfacePath path = SurfacePath();
path.moveTo(-0.284071773, -0.0622361786);
@@ -424,6 +425,20 @@ void testMain() {
}
expect(strokedSin.convexityType, SPathConvexityType.kConcave);
});
/// Regression test for https://github.com/flutter/flutter/issues/66560.
test('Quadratic', () {
final SurfacePath path = SurfacePath();
path.moveTo(100.0, 0.0);
path.quadraticBezierTo(200.0, 0.0, 200.0, 100.0);
path.quadraticBezierTo(200.0, 200.0, 100.0, 200.0);
path.quadraticBezierTo(0.0, 200.0, 0.0, 100.0);
path.quadraticBezierTo(0.0, 0.0, 100.0, 0.0);
path.close();
expect(path.contains(Offset(100, 20)), true);
expect(path.contains(Offset(100, 120)), true);
expect(path.contains(Offset(100, -10)), false);
});
});
}