Chromium Code Reviews| Index: src/core/SkPictureRecorder.cpp |
| diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp |
| index 8fbfed0229bf7dd33da635bed60089dc13ebb51e..d895a0a44e0159ac4d4df2f0b1d074b7ee2b3b89 100644 |
| --- a/src/core/SkPictureRecorder.cpp |
| +++ b/src/core/SkPictureRecorder.cpp |
| @@ -50,7 +50,7 @@ SkCanvas* SkPictureRecorder::getRecordingCanvas() { |
| return fActivelyRecording ? fRecorder.get() : nullptr; |
| } |
| -SkPicture* SkPictureRecorder::endRecordingAsPicture() { |
| +sk_sp<SkPicture> SkPictureRecorder::finishRecordingAsPicture() { |
| fActivelyRecording = false; |
| fRecorder->restoreToCount(1); // If we were missing any restores, add them now. |
| @@ -92,13 +92,13 @@ SkPicture* SkPictureRecorder::endRecordingAsPicture() { |
| for (int i = 0; pictList && i < pictList->count(); i++) { |
| subPictureBytes += SkPictureUtils::ApproximateBytesUsed(pictList->begin()[i]); |
| } |
| - return new SkBigPicture(fCullRect, fRecord.release(), pictList, fBBH.release(), |
| + return sk_make_sp<SkBigPicture>(fCullRect, fRecord.release(), pictList, fBBH.release(), |
| saveLayerData.release(), subPictureBytes); |
| } |
| -SkPicture* SkPictureRecorder::endRecordingAsPicture(const SkRect& cullRect) { |
| +sk_sp<SkPicture> SkPictureRecorder::finishRecordingAsPictureWithCull(const SkRect& cullRect) { |
| fCullRect = cullRect; |
| - return this->endRecordingAsPicture(); |
| + return this->finishRecordingAsPicture(); |
| } |
| @@ -177,7 +177,7 @@ protected: |
| } |
| }; |
| -SkDrawable* SkPictureRecorder::endRecordingAsDrawable() { |
| +sk_sp<SkDrawable> SkPictureRecorder::finishRecordingAsDrawable() { |
| fActivelyRecording = false; |
| fRecorder->flushMiniRecorder(); |
| fRecorder->restoreToCount(1); // If we were missing any restores, add them now. |
| @@ -191,13 +191,13 @@ SkDrawable* SkPictureRecorder::endRecordingAsDrawable() { |
| fBBH->insert(bounds, fRecord->count()); |
| } |
| - SkDrawable* drawable = |
| - new SkRecordedDrawable(fRecord, fBBH, fRecorder->detachDrawableList(), fCullRect, |
| + sk_sp<SkDrawable> drawable = |
| + sk_make_sp<SkRecordedDrawable>(fRecord, fBBH, fRecorder->detachDrawableList(), fCullRect, |
| SkToBool(fFlags & kComputeSaveLayerInfo_RecordFlag)); |
| // release our refs now, so only the drawable will be the owner. |
| fRecord.reset(nullptr); |
| fBBH.reset(nullptr); |
| - return drawable; |
| + return std::move(drawable); |
|
f(malita)
2016/03/18 12:48:12
IIUC move semantics clash with RVO, and the genera
f(malita)
2016/03/18 13:02:40
Maybe I imagined that conversation since I can't f
reed1
2016/03/18 14:11:51
Done.
reed1
2016/03/18 14:11:51
Thanks for the link
|
| } |