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

Unified Diff: gm/picture.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 | « gm/pathopsskpclip.cpp ('k') | gm/pictureimagefilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/picture.cpp
diff --git a/gm/picture.cpp b/gm/picture.cpp
index 1f8ded0bac39115c87e4683efed4b02acff62572..904046deb771b700de377282864e6ae6b5e95e7a 100644
--- a/gm/picture.cpp
+++ b/gm/picture.cpp
@@ -9,7 +9,7 @@
#include "SkPaint.h"
#include "SkPictureRecorder.h"
-static SkPicture* make_picture() {
+static sk_sp<SkPicture> make_picture() {
SkPictureRecorder rec;
SkCanvas* canvas = rec.beginRecording(100, 100);
@@ -32,7 +32,7 @@ static SkPicture* make_picture() {
paint.setXfermodeMode(SkXfermode::kPlus_Mode);
canvas->drawRect(SkRect::MakeXYWH(25, 25, 50, 50), paint);
- return rec.endRecording();
+ return rec.finishRecordingAsPicture();
}
// Exercise the optional arguments to drawPicture
@@ -45,7 +45,7 @@ public:
protected:
void onOnceBeforeDraw() override {
- fPicture.reset(make_picture());
+ fPicture = make_picture();
}
SkString onShortName() override {
@@ -76,7 +76,7 @@ protected:
}
private:
- SkAutoTUnref<SkPicture> fPicture;
+ sk_sp<SkPicture> fPicture;
typedef skiagm::GM INHERITED;
};
« no previous file with comments | « gm/pathopsskpclip.cpp ('k') | gm/pictureimagefilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698