aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Stephen White <senorblanco@chromium.org>2017-06-12 11:43:18 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-12 17:44:23 +0000
commite3a0be73a61147379ab0ce33a0e773c072c47908 (patch)
treea4ed24b3f8bca843a67a54621eccab36b245e68b /tests
parent50b84682c897093d35f9ce5d351574a65d3a8219 (diff)
GrTessellator: fix two NaN issues.
If a point in the path rounds to +inf/-inf, the intersection code can produce NaN, which is unsortable. Fix: ignore non-finite intersections. Quadratic interpolation can sometimes produce NaN, which will never satisfy the flatness criterion. Abort if any of the interpolated points are non-finite. Bug:732023 Change-Id: If5881796e589c75b8f74459f42d00918619713a2 Reviewed-on: https://skia-review.googlesource.com/19467 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Stephen White <senorblanco@chromium.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/TessellatingPathRendererTests.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp
index e2fca2eb82..c41e9cf3c5 100644
--- a/tests/TessellatingPathRendererTests.cpp
+++ b/tests/TessellatingPathRendererTests.cpp
@@ -326,6 +326,26 @@ static SkPath create_path_20() {
return path;
}
+// An intersection whose result is NaN (due to rounded-to-inf endpoint).
+static SkPath create_path_21() {
+ SkPath path;
+ path.moveTo(1.7889142061167663539e+38, 39338463358011572224.0);
+ path.lineTo( 1647.4193115234375, -522.603515625);
+ path.lineTo( 1677.74560546875, -529.0028076171875);
+ path.lineTo( 1678.29541015625, -528.7847900390625);
+ path.lineTo( 1637.5167236328125, -519.79266357421875);
+ path.lineTo( 1647.4193115234375, -522.603515625);
+ return path;
+}
+
+// A quad which becomes NaN when interpolated.
+static SkPath create_path_22() {
+ SkPath path;
+ path.moveTo(-5.71889e+13f, 1.36759e+09f);
+ path.quadTo(2.45472e+19f, -3.12406e+15f, -2.19589e+18f, 2.79462e+14f);
+ return path;
+}
+
static sk_sp<GrFragmentProcessor> create_linear_gradient_processor(GrContext* ctx) {
SkPoint pts[2] = { {0, 0}, {1, 1} };
SkColor colors[2] = { SK_ColorGREEN, SK_ColorBLUE };
@@ -403,5 +423,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) {
test_path(ctx, rtc.get(), create_path_18());
test_path(ctx, rtc.get(), create_path_19());
test_path(ctx, rtc.get(), create_path_20(), SkMatrix(), GrAAType::kCoverage);
+ test_path(ctx, rtc.get(), create_path_21(), SkMatrix(), GrAAType::kCoverage);
+ test_path(ctx, rtc.get(), create_path_22());
}
#endif