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

Unified Diff: tools/sk_tool_utils.cpp

Issue 1239303003: fix typeface leak (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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 | « tools/sk_tool_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/sk_tool_utils.cpp
diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp
index 03d02de9244b236e489992f6ace0278791b76153..9ab86edf2fb16c5d253f15649fead40521d7dd78 100644
--- a/tools/sk_tool_utils.cpp
+++ b/tools/sk_tool_utils.cpp
@@ -32,14 +32,17 @@ const char* platform_os_emoji() {
return "";
}
-SkTypeface* emoji_typeface() {
+void emoji_typeface(SkAutoTUnref<SkTypeface>* tf) {
if (!strcmp(sk_tool_utils::platform_os_emoji(), "CBDT")) {
- return GetResourceAsTypeface("/fonts/Funkster.ttf");
+ tf->reset(GetResourceAsTypeface("/fonts/Funkster.ttf"));
+ return;
}
if (!strcmp(sk_tool_utils::platform_os_emoji(), "SBIX")) {
- return SkTypeface::CreateFromName("Apple Color Emoji", SkTypeface::kNormal);
+ tf->reset(SkTypeface::CreateFromName("Apple Color Emoji", SkTypeface::kNormal));
+ return;
}
- return NULL;
+ tf->reset(NULL);
+ return;
}
const char* emoji_sample_text() {
« no previous file with comments | « tools/sk_tool_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698