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

Unified Diff: src/utils/SkLua.cpp

Issue 1933393002: Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address comments. Created 4 years, 8 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
Index: src/utils/SkLua.cpp
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
index 9369a6bd9db4ed9425e32d5eb5a205c787fb6603..3d21f4177074bdb7b7d286dab9203ba039837242 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -925,7 +925,7 @@ static int lpaint_getTypeface(lua_State* L) {
}
static int lpaint_setTypeface(lua_State* L) {
- get_obj<SkPaint>(L, 1)->setTypeface(get_ref<SkTypeface>(L, 2));
+ get_obj<SkPaint>(L, 1)->setTypeface(sk_ref_sp(get_ref<SkTypeface>(L, 2)));
return 0;
}
@@ -2049,13 +2049,13 @@ static int lsk_newTypeface(lua_State* L) {
}
}
- SkTypeface* face = SkTypeface::CreateFromName(name,
+ auto face = SkTypeface::MakeFromName(name,
(SkTypeface::Style)style);
f(malita) 2016/05/02 13:46:36 Nit: ditto
bungeman-skia 2016/05/02 20:24:54 Done.
// SkDebugf("---- name <%s> style=%d, face=%p ref=%d\n", name, style, face, face->getRefCnt());
if (nullptr == face) {
- face = SkTypeface::RefDefault();
+ face = SkTypeface::MakeDefault();
}
- push_ref(L, face)->unref();
+ push_ref(L, std::move(face));
return 1;
}

Powered by Google App Engine
This is Rietveld 408576698