fix typeface leak
TBR=bungeman@google.com Review URL: https://codereview.chromium.org/1239303003
This commit is contained in:
parent
494aa593c5
commit
3b0f98ee17
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -25,7 +25,7 @@ namespace sk_tool_utils {
|
||||
|
||||
const char* colortype_name(SkColorType);
|
||||
SkColor color_to_565(SkColor color);
|
||||
SkTypeface* emoji_typeface();
|
||||
void emoji_typeface(SkAutoTUnref<SkTypeface>* );
|
||||
const char* emoji_sample_text();
|
||||
const char* platform_os_emoji();
|
||||
const char* platform_os_name();
|
||||
|
Loading…
Reference in New Issue
Block a user