aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2015-07-23 11:52:01 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-23 11:52:01 -0700
commit3b0f98ee17e02aae4e1e1e9fa65d3c56104dd9c7 (patch)
tree828ebb18e845e5c5f1913e2b866ebe7b09318291 /gm
parent494aa593c59d3f426036f87ef1fab1ea158c469f (diff)
fix typeface leak
TBR=bungeman@google.com Review URL: https://codereview.chromium.org/1239303003
Diffstat (limited to 'gm')
-rw-r--r--gm/coloremoji.cpp8
-rwxr-xr-xgm/dftext.cpp2
-rw-r--r--gm/mixedtextblobs.cpp2
3 files changed, 4 insertions, 8 deletions
diff --git a/gm/coloremoji.cpp b/gm/coloremoji.cpp
index 029377e8e4..8ef335a158 100644
--- a/gm/coloremoji.cpp
+++ b/gm/coloremoji.cpp
@@ -50,11 +50,11 @@ public:
protected:
struct EmojiFont {
- SkTypeface* typeface;
+ SkAutoTUnref<SkTypeface> typeface;
const char* text;
} emojiFont;
virtual void onOnceBeforeDraw() override {
- emojiFont.typeface = sk_tool_utils::emoji_typeface();
+ sk_tool_utils::emoji_typeface(&emojiFont.typeface);
emojiFont.text = sk_tool_utils::emoji_sample_text();
}
@@ -155,10 +155,6 @@ protected:
}
}
-private:
- SkAutoTUnref<SkTypeface> fCBDT_CBLC_Typeface;
- SkAutoTUnref<SkTypeface> fSBIX_Typeface;
-
typedef GM INHERITED;
};
diff --git a/gm/dftext.cpp b/gm/dftext.cpp
index 089308329e..1a46baffb3 100755
--- a/gm/dftext.cpp
+++ b/gm/dftext.cpp
@@ -19,7 +19,7 @@ public:
protected:
void onOnceBeforeDraw() override {
- fEmojiTypeface.reset(sk_tool_utils::emoji_typeface());
+ sk_tool_utils::emoji_typeface(&fEmojiTypeface);
fEmojiText = sk_tool_utils::emoji_sample_text();
}
diff --git a/gm/mixedtextblobs.cpp b/gm/mixedtextblobs.cpp
index 53bd7f7e36..681b0b7cb1 100644
--- a/gm/mixedtextblobs.cpp
+++ b/gm/mixedtextblobs.cpp
@@ -39,7 +39,7 @@ public:
protected:
void onOnceBeforeDraw() override {
- fEmojiTypeface.reset(sk_tool_utils::emoji_typeface());
+ sk_tool_utils::emoji_typeface(&fEmojiTypeface);
fEmojiText = sk_tool_utils::emoji_sample_text();
fReallyBigATypeface.reset(GetResourceAsTypeface("/fonts/ReallyBigA.ttf"));