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

Unified Diff: tests/PictureTest.cpp

Issue 678303004: Make RTree handle the case where the playback canvas has empty clip bounds (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 6 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
« src/core/SkRecordDraw.cpp ('K') | « src/core/SkRecordDraw.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PictureTest.cpp
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index fa4dc101421da570449bbeba487624365bf5a091..85dbe65cfa0daf427f47949ea1ad226e22dea570 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -1535,6 +1535,56 @@ static void test_draw_empty(skiatest::Reporter* reporter) {
}
}
+static void test_draw_empty_clip(skiatest::Reporter* reporter) {
+ SkBitmap result;
+ make_bm(&result, 2, 2, SK_ColorGREEN, false);
+
+ // Test playing a non-empty picture into a canvas with an empty clip
+ SkCanvas destinationCanvas(result);
+ destinationCanvas.clipRect(SkRect::MakeXYWH(10, 10, 1, 1), SkRegion::kIntersect_Op);
+ SkPaint paint;
+
+ {
+ // stock SkPicture
+ SkPictureRecorder recorder;
+ SkCanvas* canvas = recorder.beginRecording(3, 3);
reed1 2014/10/28 17:39:51 we seem to make this picture three times, but only
+ canvas->drawRect(SkRect::MakeXYWH(0, 0, 3, 3), paint);
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording());
+
+ destinationCanvas.drawPicture(picture);
+ REPORTER_ASSERT(reporter, SK_ColorGREEN == result.getColor(0, 0));
+ }
+
+ {
+ // tile grid
+ SkTileGridFactory::TileGridInfo gridInfo;
+ gridInfo.fMargin.setEmpty();
+ gridInfo.fOffset.setZero();
+ gridInfo.fTileInterval.set(1, 1);
+
+ SkTileGridFactory factory(gridInfo);
+ SkPictureRecorder recorder;
+ SkCanvas* canvas = recorder.beginRecording(3, 3, &factory);
+ canvas->drawRect(SkRect::MakeXYWH(0, 0, 3, 3), paint);
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording());
+
+ destinationCanvas.drawPicture(picture);
+ REPORTER_ASSERT(reporter, SK_ColorGREEN == result.getColor(0, 0));
+ }
+
+ {
+ // RTree
+ SkRTreeFactory factory;
+ SkPictureRecorder recorder;
+ SkCanvas* canvas = recorder.beginRecording(3, 3, &factory);
+ canvas->drawRect(SkRect::MakeXYWH(0, 0, 3, 3), paint);
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording());
+
+ destinationCanvas.drawPicture(picture);
+ REPORTER_ASSERT(reporter, SK_ColorGREEN == result.getColor(0, 0));
+ }
+}
+
static void test_clip_bound_opt(skiatest::Reporter* reporter) {
// Test for crbug.com/229011
SkRect rect1 = SkRect::MakeXYWH(SkIntToScalar(4), SkIntToScalar(4),
@@ -1766,6 +1816,7 @@ DEF_TEST(Picture, reporter) {
test_gatherpixelrefsandrects(reporter);
test_bitmap_with_encoded_data(reporter);
test_draw_empty(reporter);
+ test_draw_empty_clip(reporter);
test_clip_bound_opt(reporter);
test_clip_expansion(reporter);
test_hierarchical(reporter);
« src/core/SkRecordDraw.cpp ('K') | « src/core/SkRecordDraw.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698