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

Unified Diff: tests/PictureTest.cpp

Issue 1178673007: Allow reset of the SkPictureRecorder cull rect before endRecording. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Removed bbhFactory Created 5 years, 5 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/SkPictureRecorder.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 0ccef3f0a92f2b8403278fc3cdd7326349001847..b235a0cc23e512ffe0c2122c83be19dc25ba61fd 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -984,6 +984,33 @@ static void test_clip_bound_opt(skiatest::Reporter* reporter) {
}
}
+static void test_cull_rect_reset(skiatest::Reporter* reporter) {
+ SkPictureRecorder recorder;
+ SkRect bounds = SkRect::MakeWH(10, 10);
+ SkRTreeFactory factory;
+ SkCanvas* canvas = recorder.beginRecording(bounds, &factory);
+ bounds = SkRect::MakeWH(100, 100);
+ SkPaint paint;
+ canvas->drawRect(bounds, paint);
+ canvas->drawRect(bounds, paint);
+ const SkBigPicture* picture = recorder.endRecordingAsPicture(bounds)->asSkBigPicture();
+ REPORTER_ASSERT(reporter, picture);
+
+ SkRect finalCullRect = picture->cullRect();
+ REPORTER_ASSERT(reporter, 0 == finalCullRect.fLeft);
+ REPORTER_ASSERT(reporter, 0 == finalCullRect.fTop);
+ REPORTER_ASSERT(reporter, 100 == finalCullRect.fBottom);
+ REPORTER_ASSERT(reporter, 100 == finalCullRect.fRight);
+
+ const SkBBoxHierarchy* pictureBBH = picture->bbh();
+ SkRect bbhCullRect = pictureBBH->getRootBound();
+ REPORTER_ASSERT(reporter, 0 == bbhCullRect.fLeft);
+ REPORTER_ASSERT(reporter, 0 == bbhCullRect.fTop);
+ REPORTER_ASSERT(reporter, 100 == bbhCullRect.fBottom);
+ REPORTER_ASSERT(reporter, 100 == bbhCullRect.fRight);
+}
+
+
/**
* A canvas that records the number of clip commands.
*/
@@ -1129,6 +1156,7 @@ DEF_TEST(Picture, reporter) {
test_hierarchical(reporter);
test_gen_id(reporter);
test_savelayer_extraction(reporter);
+ test_cull_rect_reset(reporter);
}
static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) {
« no previous file with comments | « src/core/SkPictureRecorder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698