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

Unified Diff: tests/RectTest.cpp

Issue 1424253002: SkScan_Antihair: assert in debug and potentialy lost last pixels (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: test Created 5 years, 2 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_Antihair.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/RectTest.cpp
diff --git a/tests/RectTest.cpp b/tests/RectTest.cpp
index be77a87406168a4bae5463c96c38bf8d114c4bfa..1ced83f7e362defdca048bcd8b0d8fa1152c32c7 100644
--- a/tests/RectTest.cpp
+++ b/tests/RectTest.cpp
@@ -46,6 +46,45 @@ static void test_stroke_width_clipping(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, has_green_pixels(bm));
}
+static void test_skbug4406(skiatest::Reporter* reporter) {
+ SkBitmap bm;
+ bm.allocN32Pixels(10, 10);
+ bm.eraseColor(SK_ColorTRANSPARENT);
+
+ SkCanvas canvas(bm);
+ const SkRect r = { 1.5f, 1, 3.5f, 3 };
+ // draw filled green rect first
+ SkPaint paint;
+ paint.setStyle(SkPaint::kFill_Style);
+ paint.setColor(0xff00ff00);
+ paint.setStrokeWidth(1);
+ paint.setAntiAlias(true);
+ canvas.drawRect(r, paint);
+
+ // paint black with stroke rect (that asserts in bug 4406)
+ // over the filled rect, it should cover it
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setColor(0xff000000);
+ paint.setStrokeWidth(1);
+ canvas.drawRect(r, paint);
+ REPORTER_ASSERT(reporter, !has_green_pixels(bm));
+
+ // do it again with thinner stroke
+ paint.setStyle(SkPaint::kFill_Style);
+ paint.setColor(0xff00ff00);
+ paint.setStrokeWidth(1);
+ paint.setAntiAlias(true);
+ canvas.drawRect(r, paint);
+ // paint black with stroke rect (that asserts in bug 4406)
+ // over the filled rect, it doesnt cover it completelly with thinner stroke
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setColor(0xff000000);
+ paint.setStrokeWidth(0.99f);
+ canvas.drawRect(r, paint);
+ REPORTER_ASSERT(reporter, has_green_pixels(bm));
+}
+
DEF_TEST(Rect, reporter) {
test_stroke_width_clipping(reporter);
+ test_skbug4406(reporter);
}
« no previous file with comments | « src/core/SkScan_Antihair.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698