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

Side by Side Diff: gm/mixedtextblobs.cpp

Issue 1239303003: fix typeface leak (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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/dftext.cpp ('k') | tools/sk_tool_utils.h » ('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 2013 Google Inc. 2 * Copyright 2013 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 7
8 #include "gm.h" 8 #include "gm.h"
9 9
10 #include "Resources.h" 10 #include "Resources.h"
(...skipping 21 matching lines...) Expand all
32 canvas->drawTextBlob(blob, 0, 0, paint); 32 canvas->drawTextBlob(blob, 0, 0, paint);
33 canvas->restore(); 33 canvas->restore();
34 } 34 }
35 35
36 class MixedTextBlobsGM : public GM { 36 class MixedTextBlobsGM : public GM {
37 public: 37 public:
38 MixedTextBlobsGM() { } 38 MixedTextBlobsGM() { }
39 39
40 protected: 40 protected:
41 void onOnceBeforeDraw() override { 41 void onOnceBeforeDraw() override {
42 fEmojiTypeface.reset(sk_tool_utils::emoji_typeface()); 42 sk_tool_utils::emoji_typeface(&fEmojiTypeface);
43 fEmojiText = sk_tool_utils::emoji_sample_text(); 43 fEmojiText = sk_tool_utils::emoji_sample_text();
44 fReallyBigATypeface.reset(GetResourceAsTypeface("/fonts/ReallyBigA.ttf") ); 44 fReallyBigATypeface.reset(GetResourceAsTypeface("/fonts/ReallyBigA.ttf") );
45 45
46 SkTextBlobBuilder builder; 46 SkTextBlobBuilder builder;
47 47
48 // make textblob 48 // make textblob
49 // Text so large we draw as paths 49 // Text so large we draw as paths
50 SkPaint paint; 50 SkPaint paint;
51 paint.setTextSize(385); 51 paint.setTextSize(385);
52 const char* text = "O"; 52 const char* text = "O";
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 static const int kWidth = 1250; 156 static const int kWidth = 1250;
157 static const int kHeight = 700; 157 static const int kHeight = 700;
158 158
159 typedef GM INHERITED; 159 typedef GM INHERITED;
160 }; 160 };
161 161
162 ////////////////////////////////////////////////////////////////////////////// 162 //////////////////////////////////////////////////////////////////////////////
163 163
164 DEF_GM( return SkNEW(MixedTextBlobsGM); ) 164 DEF_GM( return SkNEW(MixedTextBlobsGM); )
165 } 165 }
OLDNEW
« no previous file with comments | « gm/dftext.cpp ('k') | tools/sk_tool_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698