diff options
author | bungeman <bungeman@google.com> | 2016-05-11 12:38:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-11 12:38:18 -0700 |
commit | 6296da736fbf40aae881650c239420f64e576c3f (patch) | |
tree | 5121ecf46ff7099d8eb66d2b2a4671d5ad94db89 /tools/sk_tool_utils_font.cpp | |
parent | c8699321b924c1f284df93cb29b86000c1d73c0a (diff) |
Move SkTypeface to sk_sp.
Review-Url: https://codereview.chromium.org/1933393002
Diffstat (limited to 'tools/sk_tool_utils_font.cpp')
-rw-r--r-- | tools/sk_tool_utils_font.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/sk_tool_utils_font.cpp b/tools/sk_tool_utils_font.cpp index adbfa1692b..f73576dbf6 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)); } } |