diff options
author | fmalita <fmalita@chromium.org> | 2015-07-14 13:12:25 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-14 13:12:25 -0700 |
commit | 2ecc0005364fcd07ef8eec62521f4dbcadff675e (patch) | |
tree | 23c6846eb2d5fbde9c27c24419d374ba3fdaa54c /tests | |
parent | e8c5666e0387e70bd921e01558e627af3f1411db (diff) |
Preserve SKP cullrects on deserialization
Let's not ignore the offset.
R=reed@google.com,mtklein@google.com
Review URL: https://codereview.chromium.org/1235953004
Diffstat (limited to 'tests')
-rw-r--r-- | tests/PictureTest.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp index ae1ef65002..ba66286350 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); +} |