Move SkTypeface to sk_sp.
Committed: https://skia.googlesource.com/skia/+/6296da736fbf40aae881650c239420f64e576c3f
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1933393002
Review-Url: https://codereview.chromium.org/1933393002
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
index 886f3d4..4409e47 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -925,7 +925,7 @@
}
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,12 @@
}
}
- SkTypeface* face = SkTypeface::CreateFromName(name,
- (SkTypeface::Style)style);
+ sk_sp<SkTypeface> face(SkTypeface::MakeFromName(name, (SkTypeface::Style)style));
// 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;
}