OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 TextBlobGM(const char* txt) | 69 TextBlobGM(const char* txt) |
70 : fText(txt) { | 70 : fText(txt) { |
71 } | 71 } |
72 | 72 |
73 protected: | 73 protected: |
74 void onOnceBeforeDraw() override { | 74 void onOnceBeforeDraw() override { |
75 fTypeface.reset(sk_tool_utils::create_portable_typeface("serif", SkTypef
ace::kNormal)); | 75 fTypeface.reset(sk_tool_utils::create_portable_typeface("serif", SkTypef
ace::kNormal)); |
76 SkPaint p; | 76 SkPaint p; |
77 p.setTypeface(fTypeface); | 77 p.setTypeface(fTypeface); |
78 size_t txtLen = strlen(fText); | 78 size_t txtLen = strlen(fText); |
79 int glyphCount = p.textToGlyphs(fText, txtLen, NULL); | 79 int glyphCount = p.textToGlyphs(fText, txtLen, nullptr); |
80 | 80 |
81 fGlyphs.append(glyphCount); | 81 fGlyphs.append(glyphCount); |
82 p.textToGlyphs(fText, txtLen, fGlyphs.begin()); | 82 p.textToGlyphs(fText, txtLen, fGlyphs.begin()); |
83 } | 83 } |
84 | 84 |
85 SkString onShortName() override { | 85 SkString onShortName() override { |
86 return SkString("textblob"); | 86 return SkString("textblob"); |
87 } | 87 } |
88 | 88 |
89 SkISize onISize() override { | 89 SkISize onISize() override { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 return builder.build(); | 180 return builder.build(); |
181 } | 181 } |
182 | 182 |
183 SkTDArray<uint16_t> fGlyphs; | 183 SkTDArray<uint16_t> fGlyphs; |
184 SkAutoTUnref<SkTypeface> fTypeface; | 184 SkAutoTUnref<SkTypeface> fTypeface; |
185 const char* fText; | 185 const char* fText; |
186 typedef skiagm::GM INHERITED; | 186 typedef skiagm::GM INHERITED; |
187 }; | 187 }; |
188 | 188 |
189 DEF_GM(return new TextBlobGM("hamburgefons");) | 189 DEF_GM(return new TextBlobGM("hamburgefons");) |
OLD | NEW |