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

Unified Diff: src/utils/SkLua.cpp

Issue 1810813003: update callsites for Make image factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: start to take advantage of sk_sp drawImage 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/pdf/SkPDFDevice.cpp ('k') | tests/CachedDecodingPixelRefTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkLua.cpp
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
index 95ca5adc07389eed82a984a6f6f88d04b16df81a..868a8250ef3a658b91c213101ca82e58a7c7e600 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -1756,11 +1756,11 @@ static int lsurface_getCanvas(lua_State* L) {
}
static int lsurface_newImageSnapshot(lua_State* L) {
- SkImage* image = get_ref<SkSurface>(L, 1)->newImageSnapshot();
- if (nullptr == image) {
+ sk_sp<SkImage> image = get_ref<SkSurface>(L, 1)->makeImageSnapshot();
+ if (!image) {
lua_pushnil(L);
} else {
- push_ref(L, image)->unref();
+ push_ref(L, image);
}
return 1;
}
@@ -2075,11 +2075,11 @@ static int lsk_newRasterSurface(lua_State* L) {
static int lsk_loadImage(lua_State* L) {
if (lua_gettop(L) > 0 && lua_isstring(L, 1)) {
const char* name = lua_tolstring(L, 1, nullptr);
- SkAutoDataUnref data(SkData::NewFromFileName(name));
- if (data.get()) {
- SkImage* image = SkImage::NewFromEncoded(data);
+ sk_sp<SkData> data(SkData::MakeFromFileName(name));
+ if (data) {
+ auto image = SkImage::MakeFromEncoded(std::move(data));
if (image) {
- push_ref(L, image)->unref();
+ push_ref(L, std::move(image));
return 1;
}
}
« no previous file with comments | « src/pdf/SkPDFDevice.cpp ('k') | tests/CachedDecodingPixelRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698