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

Unified Diff: src/core/SkPicture.cpp

Issue 1811703002: return pictures as sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rely on RVO in picturerecorder Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkMiniRecorder.cpp ('k') | src/core/SkPictureData.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPicture.cpp
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index f2b199d317176b5c98318e95d4565f08e1c2a5a3..c7e5e524b038e8d5fdf0f7fdbfc87f6ba7ed9429 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -129,14 +129,14 @@ bool SkPicture::InternalOnly_BufferIsSKP(SkReadBuffer* buffer, SkPictInfo* pInfo
return false;
}
-SkPicture* SkPicture::Forwardport(const SkPictInfo& info, const SkPictureData* data) {
+sk_sp<SkPicture> SkPicture::Forwardport(const SkPictInfo& info, const SkPictureData* data) {
if (!data) {
return nullptr;
}
SkPicturePlayback playback(data);
SkPictureRecorder r;
playback.draw(r.beginRecording(info.fCullRect), nullptr/*no callback*/);
- return r.endRecording();
+ return r.finishRecordingAsPicture();
}
static bool default_install(const void* src, size_t length, SkBitmap* dst) {
@@ -145,17 +145,16 @@ static bool default_install(const void* src, size_t length, SkBitmap* dst) {
SkImageGenerator::NewFromEncoded(encoded.get()), dst);
}
-SkPicture* SkPicture::CreateFromStream(SkStream* stream) {
- return CreateFromStream(stream, &default_install, nullptr);
+sk_sp<SkPicture> SkPicture::MakeFromStream(SkStream* stream) {
+ return MakeFromStream(stream, &default_install, nullptr);
}
-SkPicture* SkPicture::CreateFromStream(SkStream* stream, InstallPixelRefProc proc) {
- return CreateFromStream(stream, proc, nullptr);
+sk_sp<SkPicture> SkPicture::MakeFromStream(SkStream* stream, InstallPixelRefProc proc) {
+ return MakeFromStream(stream, proc, nullptr);
}
-SkPicture* SkPicture::CreateFromStream(SkStream* stream,
- InstallPixelRefProc proc,
- SkTypefacePlayback* typefaces) {
+sk_sp<SkPicture> SkPicture::MakeFromStream(SkStream* stream, InstallPixelRefProc proc,
+ SkTypefacePlayback* typefaces) {
SkPictInfo info;
if (!InternalOnly_StreamIsSKP(stream, &info) || !stream->readBool()) {
return nullptr;
@@ -165,7 +164,7 @@ SkPicture* SkPicture::CreateFromStream(SkStream* stream,
return Forwardport(info, data);
}
-SkPicture* SkPicture::CreateFromBuffer(SkReadBuffer& buffer) {
+sk_sp<SkPicture> SkPicture::MakeFromBuffer(SkReadBuffer& buffer) {
SkPictInfo info;
if (!InternalOnly_BufferIsSKP(&buffer, &info) || !buffer.readBool()) {
return nullptr;
« no previous file with comments | « src/core/SkMiniRecorder.cpp ('k') | src/core/SkPictureData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698