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

Unified Diff: tests/PictureTest.cpp

Issue 732653004: option to return drawable from recording (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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/gpu/GrRecordReplaceDraw.cpp ('k') | tests/RecordDrawTest.cpp » ('j') | 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 ab2fcb72397abd947194046f52341f95ec9605d8..64073d3b005a25b84080cda11263cee3e791ed3c 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -1733,7 +1733,8 @@ static void test_bytes_used(skiatest::Reporter* reporter) {
sizeof(SkPicture) + sizeof(SkRecord));
// Protect against any unintentional bloat.
- REPORTER_ASSERT(reporter, SkPictureUtils::ApproximateBytesUsed(empty.get()) <= 128);
+ size_t approxUsed = SkPictureUtils::ApproximateBytesUsed(empty.get());
+ REPORTER_ASSERT(reporter, approxUsed <= 136);
// Sanity check of nested SkPictures.
SkPictureRecorder r2;
@@ -1905,11 +1906,16 @@ DEF_TEST(Picture_BitmapLeak, r) {
REPORTER_ASSERT(r, mut.pixelRef()->unique());
REPORTER_ASSERT(r, immut.pixelRef()->unique());
- SkPictureRecorder rec;
- SkCanvas* canvas = rec.beginRecording(1920, 1200);
- canvas->drawBitmap(mut, 0, 0);
- canvas->drawBitmap(immut, 800, 600);
- SkAutoTUnref<const SkPicture> pic(rec.endRecording());
+ SkAutoTUnref<const SkPicture> pic;
+ {
+ // we want the recorder to go out of scope before our subsequent checks, so we
+ // place it inside local braces.
+ SkPictureRecorder rec;
+ SkCanvas* canvas = rec.beginRecording(1920, 1200);
+ canvas->drawBitmap(mut, 0, 0);
+ canvas->drawBitmap(immut, 800, 600);
+ pic.reset(rec.endRecording());
+ }
// The picture shares the immutable pixels but copies the mutable ones.
REPORTER_ASSERT(r, mut.pixelRef()->unique());
« no previous file with comments | « src/gpu/GrRecordReplaceDraw.cpp ('k') | tests/RecordDrawTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698