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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/core/SkPicture.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBBoxHierarchy.h" 8 #include "SkBBoxHierarchy.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 1335
1336 DEF_TEST(MiniRecorderLeftHanging, r) { 1336 DEF_TEST(MiniRecorderLeftHanging, r) {
1337 // Any shader or other ref-counted effect will do just fine here. 1337 // Any shader or other ref-counted effect will do just fine here.
1338 SkPaint paint; 1338 SkPaint paint;
1339 paint.setShader(SkShader::CreateColorShader(SK_ColorRED))->unref(); 1339 paint.setShader(SkShader::CreateColorShader(SK_ColorRED))->unref();
1340 1340
1341 SkMiniRecorder rec; 1341 SkMiniRecorder rec;
1342 REPORTER_ASSERT(r, rec.drawRect(SkRect::MakeWH(20,30), paint)); 1342 REPORTER_ASSERT(r, rec.drawRect(SkRect::MakeWH(20,30), paint));
1343 // Don't call rec.detachPicture(). Test succeeds by not asserting or leakin g the shader. 1343 // Don't call rec.detachPicture(). Test succeeds by not asserting or leakin g the shader.
1344 } 1344 }
1345
1346 DEF_TEST(Picture_preserveCullRect, r) {
1347 SkPictureRecorder recorder;
1348
1349 SkCanvas* c = recorder.beginRecording(SkRect::MakeLTRB(1, 2, 3, 4));
1350 c->clear(SK_ColorCYAN);
1351
1352 SkAutoTUnref<SkPicture> picture(recorder.endRecording());
1353 SkDynamicMemoryWStream wstream;
1354 picture->serialize(&wstream);
1355
1356 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream());
1357 SkAutoTUnref<SkPicture> deserializedPicture(SkPicture::CreateFromStream(rstr eam));
1358
1359 REPORTER_ASSERT(r, SkToBool(deserializedPicture));
1360 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1);
1361 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2);
1362 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3);
1363 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4);
1364 }
OLDNEW
« 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