Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: tests/DrawPathTest.cpp

Issue 1544873002: handle halfway case in scan converter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add more comments Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkScan_Path.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/DrawPathTest.cpp
diff --git a/tests/DrawPathTest.cpp b/tests/DrawPathTest.cpp
index 721b0304779c4b4572c5575c4653e48039316800..7f917991379db1d8e3f8f9bcb2d9044f4eae9024 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();
}
« no previous file with comments | « src/core/SkScan_Path.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698