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

Unified Diff: tests/PictureTest.cpp

Issue 1235953004: Preserve SKP cullrects on deserialization (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: 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/SkPicture.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 ae1ef6500257ffe63caa8f31df16b3c711f49ce1..ba6628635054cbc999024cc8769fa43e7dd76cdf 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -1342,3 +1342,23 @@ DEF_TEST(MiniRecorderLeftHanging, r) {
REPORTER_ASSERT(r, rec.drawRect(SkRect::MakeWH(20,30), paint));
// Don't call rec.detachPicture(). Test succeeds by not asserting or leaking the shader.
}
+
+DEF_TEST(Picture_preserveCullRect, r) {
+ SkPictureRecorder recorder;
+
+ SkCanvas* c = recorder.beginRecording(SkRect::MakeLTRB(1, 2, 3, 4));
+ c->clear(SK_ColorCYAN);
+
+ SkAutoTUnref<SkPicture> picture(recorder.endRecording());
+ SkDynamicMemoryWStream wstream;
+ picture->serialize(&wstream);
+
+ SkAutoTDelete<SkStream> rstream(wstream.detachAsStream());
+ SkAutoTUnref<SkPicture> deserializedPicture(SkPicture::CreateFromStream(rstream));
+
+ REPORTER_ASSERT(r, SkToBool(deserializedPicture));
+ REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1);
+ REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2);
+ REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3);
+ REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4);
+}
« no previous file with comments | « src/core/SkPicture.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698