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

Unified Diff: tools/lua/lua_pictures.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 | « tools/kilobench/kilobench.cpp ('k') | tools/pinspect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lua/lua_pictures.cpp
diff --git a/tools/lua/lua_pictures.cpp b/tools/lua/lua_pictures.cpp
index c526406f1ced368d863c275ee254e5aa25212284..0edea2576ed4ec2f8144e10b3ee0fc1d64c8d757 100644
--- a/tools/lua/lua_pictures.cpp
+++ b/tools/lua/lua_pictures.cpp
@@ -38,13 +38,12 @@ DEFINE_string2(headCode, s, "", "Optional lua code to call at beginning");
DEFINE_string2(tailFunc, s, "", "Optional lua function to call at end");
DEFINE_bool2(quiet, q, false, "Silence all non-error related output");
-static SkPicture* load_picture(const char path[]) {
+static sk_sp<SkPicture> load_picture(const char path[]) {
SkAutoTDelete<SkStream> stream(SkStream::NewFromFile(path));
- SkPicture* pic = nullptr;
if (stream.get()) {
- pic = SkPicture::CreateFromStream(stream.get());
+ return SkPicture::MakeFromStream(stream.get());
}
- return pic;
+ return nullptr;
}
static void call_canvas(lua_State* L, SkLuaCanvas* canvas,
@@ -143,7 +142,7 @@ int tool_main(int argc, char** argv) {
SkDebugf("scraping %s %s\n", path, moduloStr.c_str());
}
- SkAutoTUnref<SkPicture> pic(load_picture(path));
+ auto pic(load_picture(path));
if (pic.get()) {
SkAutoTUnref<SkLuaCanvas> canvas(
new SkLuaCanvas(SkScalarCeilToInt(pic->cullRect().width()),
« no previous file with comments | « tools/kilobench/kilobench.cpp ('k') | tools/pinspect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698