diff options
author | reed <reed@google.com> | 2016-03-18 07:25:55 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-18 07:25:55 -0700 |
commit | ca2622ba051829fed5f30facd74c5b41cd4b931c (patch) | |
tree | 3d8248b7764e500f857b3d6cfb6866e72b632199 /src/core/SkMiniRecorder.cpp | |
parent | eb75c7db3a7372de68347d0df8d58acebc33a9ad (diff) |
return pictures as sk_sp
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1811703002
Review URL: https://codereview.chromium.org/1811703002
Diffstat (limited to 'src/core/SkMiniRecorder.cpp')
-rw-r--r-- | src/core/SkMiniRecorder.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/SkMiniRecorder.cpp b/src/core/SkMiniRecorder.cpp index ea179d78b3..2d5b0943e5 100644 --- a/src/core/SkMiniRecorder.cpp +++ b/src/core/SkMiniRecorder.cpp @@ -62,7 +62,7 @@ SkMiniRecorder::~SkMiniRecorder() { if (fState != State::kEmpty) { // We have internal state pending. // Detaching then deleting a picture is an easy way to clean up. - delete this->detachAsPicture(SkRect::MakeEmpty()); + (void)this->detachAsPicture(SkRect::MakeEmpty()); } SkASSERT(fState == State::kEmpty); } @@ -101,14 +101,14 @@ bool SkMiniRecorder::drawTextBlob(const SkTextBlob* b, SkScalar x, SkScalar y, c #undef TRY_TO_STORE -SkPicture* SkMiniRecorder::detachAsPicture(const SkRect& cull) { +sk_sp<SkPicture> SkMiniRecorder::detachAsPicture(const SkRect& cull) { #define CASE(Type) \ case State::k##Type: \ fState = State::kEmpty; \ - return new SkMiniPicture<Type>(cull, reinterpret_cast<Type*>(fBuffer.get())) + return sk_make_sp<SkMiniPicture<Type>>(cull, reinterpret_cast<Type*>(fBuffer.get())) switch (fState) { - case State::kEmpty: return SkRef(gEmptyPicture.get([]{ return new SkEmptyPicture; })); + case State::kEmpty: return sk_ref_sp(gEmptyPicture.get([]{ return new SkEmptyPicture; })); CASE(DrawBitmapRectFixedSize); CASE(DrawPath); CASE(DrawRect); |