Index: tools/sk_tool_utils_font.cpp |
diff --git a/tools/sk_tool_utils_font.cpp b/tools/sk_tool_utils_font.cpp |
index adbfa1692b3191057e481591580baeed125b254c..f73576dbf6eb079ad1c34cc8ccadbff60245fd3b 100644 |
--- a/tools/sk_tool_utils_font.cpp |
+++ b/tools/sk_tool_utils_font.cpp |
@@ -29,7 +29,7 @@ void release_portable_typefaces() { |
SK_DECLARE_STATIC_MUTEX(gTestFontMutex); |
-SkTypeface* create_font(const char* name, SkTypeface::Style style) { |
+sk_sp<SkTypeface> create_font(const char* name, SkTypeface::Style style) { |
SkTestFontData* fontData = nullptr; |
const SubFont* sub; |
if (name) { |
@@ -47,7 +47,8 @@ SkTypeface* create_font(const char* name, SkTypeface::Style style) { |
// If we called SkTypeface::CreateFromName() here we'd recurse infinitely, |
// so we reimplement its core logic here inline without the recursive aspect. |
SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); |
- return fm->legacyCreateTypeface(name, SkFontStyle::FromOldStyle(style)); |
+ return sk_sp<SkTypeface>(fm->legacyCreateTypeface(name, |
+ SkFontStyle::FromOldStyle(style))); |
} |
} else { |
sub = &gSubFonts[gDefaultFontIndex]; |
@@ -65,7 +66,7 @@ SkTypeface* create_font(const char* name, SkTypeface::Style style) { |
fontData->fFontCache = SkSafeRef(font); |
} |
} |
- return new SkTestTypeface(font, SkFontStyle::FromOldStyle(style)); |
+ return sk_make_sp<SkTestTypeface>(font, SkFontStyle::FromOldStyle(style)); |
} |
} |