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

Unified Diff: samplecode/SampleApp.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 | « samplecode/SampleAll.cpp ('k') | samplecode/SampleArc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleApp.cpp
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 72122234d9151d1d207f34d6a388467b163202b5..05d6ce0f7dc5fac6beb216c7ffa65417605bcbb5 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -1389,7 +1389,7 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
}
if (fSaveToSKP) {
- SkAutoTUnref<const SkPicture> picture(fRecorder.endRecording());
+ sk_sp<SkPicture> picture(fRecorder.finishRecordingAsPicture());
SkFILEWStream stream("sample_app.skp");
picture->serialize(&stream);
fSaveToSKP = false;
@@ -1398,7 +1398,7 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
}
if (fUsePicture) {
- SkAutoTUnref<const SkPicture> picture(fRecorder.endRecording());
+ sk_sp<SkPicture> picture(fRecorder.finishRecordingAsPicture());
// serialize/deserialize?
if (false) {
@@ -1406,9 +1406,9 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
picture->serialize(&wstream);
SkAutoTDelete<SkStream> rstream(wstream.detachAsStream());
- picture.reset(SkPicture::CreateFromStream(rstream));
+ picture = SkPicture::MakeFromStream(rstream);
}
- orig->drawPicture(picture);
+ orig->drawPicture(picture.get());
}
// Do this after presentGL and other finishing, rather than in afterChild
« no previous file with comments | « samplecode/SampleAll.cpp ('k') | samplecode/SampleArc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698