option to return drawable from recording
patch from issue 747033005 at patchset 80001 (http://crrev.com/747033005#ps80001)
BUG=skia:
Review URL: https://codereview.chromium.org/732653004
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index ab2fcb7..64073d3 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -1733,7 +1733,8 @@
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 @@
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());