aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2016-01-04 14:17:47 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-04 14:17:47 -0800
commit6df611574a3cf8abf2617af0d03a5553bb17360d (patch)
tree1e5bcb0e8c8048ad8958286ff4a7a37cf4829790 /tests
parent512f3e3b2592097a39bde9331829b38d16c0f85d (diff)
handle halfway case in scan converter
Scan edges that start at exactly -0.5 aren't trimmed by clipping or by rounding, triggering a debug assert. One way to fix this is to round the top and left down instead of up. Also, move the path initialization of gm/composeshader.cpp to make debugging other path problems easier. R=reed@google.com BUG=skia:2715 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1544873002 Review URL: https://codereview.chromium.org/1544873002
Diffstat (limited to 'tests')
-rw-r--r--tests/DrawPathTest.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/DrawPathTest.cpp b/tests/DrawPathTest.cpp
index 721b030477..364a297123 100644
--- a/tests/DrawPathTest.cpp
+++ b/tests/DrawPathTest.cpp
@@ -217,6 +217,45 @@ static void test_bigcubic() {
surface->getCanvas()->drawPath(path, paint);
}
+// asserts if halfway case is not handled
+static void test_halfway() {
+ SkPaint paint;
+ SkPath path;
+ path.moveTo(16365.5f, 1394);
+ path.lineTo(16365.5f, 1387.5f);
+ path.quadTo(16365.5f, 1385.43f, 16367, 1383.96f);
+ path.quadTo(16368.4f, 1382.5f, 16370.5f, 1382.5f);
+ path.lineTo(16465.5f, 1382.5f);
+ path.quadTo(16467.6f, 1382.5f, 16469, 1383.96f);
+ path.quadTo(16470.5f, 1385.43f, 16470.5f, 1387.5f);
+ path.lineTo(16470.5f, 1394);
+ path.quadTo(16470.5f, 1396.07f, 16469, 1397.54f);
+ path.quadTo(16467.6f, 1399, 16465.5f, 1399);
+ path.lineTo(16370.5f, 1399);
+ path.quadTo(16368.4f, 1399, 16367, 1397.54f);
+ path.quadTo(16365.5f, 1396.07f, 16365.5f, 1394);
+ path.close();
+ SkPath p2;
+ SkMatrix m;
+ m.reset();
+ m.postTranslate(0.001f, 0.001f);
+ path.transform(m, &p2);
+
+ SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(640, 480));
+ SkCanvas* canvas = surface->getCanvas();
+ canvas->translate(-16366, -1383);
+ canvas->drawPath(p2, paint);
+
+ m.reset();
+ m.postTranslate(-0.001f, -0.001f);
+ path.transform(m, &p2);
+ canvas->drawPath(p2, paint);
+
+ m.reset();
+ path.transform(m, &p2);
+ canvas->drawPath(p2, paint);
+}
+
// we used to assert if the bounds of the device (clip) was larger than 32K
// even when the path itself was smaller. We just draw and hope in the debug
// version to not assert.
@@ -287,4 +326,5 @@ DEF_TEST(DrawPath, reporter) {
test_infinite_dash(reporter);
test_crbug_165432(reporter);
test_big_aa_rect(reporter);
+ test_halfway();
}