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

Side by Side Diff: gm/dftext.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 unified diff | Download patch
« no previous file with comments | « gm/coloremoji.cpp ('k') | gm/mixedtextblobs.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "gm.h" 7 #include "gm.h"
8 #include "Resources.h" 8 #include "Resources.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkStream.h" 10 #include "SkStream.h"
11 #include "SkSurface.h" 11 #include "SkSurface.h"
12 #include "SkTypeface.h" 12 #include "SkTypeface.h"
13 13
14 class DFTextGM : public skiagm::GM { 14 class DFTextGM : public skiagm::GM {
15 public: 15 public:
16 DFTextGM() { 16 DFTextGM() {
17 this->setBGColor(0xFFFFFFFF); 17 this->setBGColor(0xFFFFFFFF);
18 } 18 }
19 19
20 protected: 20 protected:
21 void onOnceBeforeDraw() override { 21 void onOnceBeforeDraw() override {
22 fEmojiTypeface.reset(sk_tool_utils::emoji_typeface()); 22 sk_tool_utils::emoji_typeface(&fEmojiTypeface);
23 fEmojiText = sk_tool_utils::emoji_sample_text(); 23 fEmojiText = sk_tool_utils::emoji_sample_text();
24 } 24 }
25 25
26 SkString onShortName() override { 26 SkString onShortName() override {
27 SkString name("dftext"); 27 SkString name("dftext");
28 name.append(sk_tool_utils::platform_os_emoji()); 28 name.append(sk_tool_utils::platform_os_emoji());
29 return name; 29 return name;
30 } 30 }
31 31
32 SkISize onISize() override { 32 SkISize onISize() override {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 221 }
222 222
223 private: 223 private:
224 SkAutoTUnref<SkTypeface> fEmojiTypeface; 224 SkAutoTUnref<SkTypeface> fEmojiTypeface;
225 const char* fEmojiText; 225 const char* fEmojiText;
226 226
227 typedef skiagm::GM INHERITED; 227 typedef skiagm::GM INHERITED;
228 }; 228 };
229 229
230 DEF_GM( return SkNEW(DFTextGM); ) 230 DEF_GM( return SkNEW(DFTextGM); )
OLDNEW
« no previous file with comments | « gm/coloremoji.cpp ('k') | gm/mixedtextblobs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698