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 15 matching lines...) Expand all Loading... |
26 } | 26 } |
27 | 27 |
28 protected: | 28 protected: |
29 | 29 |
30 void onOnceBeforeDraw() override { | 30 void onOnceBeforeDraw() override { |
31 SkPaint p; | 31 SkPaint p; |
32 p.setAntiAlias(true); | 32 p.setAntiAlias(true); |
33 p.setSubpixelText(true); | 33 p.setSubpixelText(true); |
34 p.setTextSize(30); | 34 p.setTextSize(30); |
35 p.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | 35 p.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
| 36 sk_tool_utils::set_portable_typeface(&p); |
36 | 37 |
37 SkTextBlobBuilder builder; | 38 SkTextBlobBuilder builder; |
38 int glyphCount = fGlyphs.count(); | 39 int glyphCount = fGlyphs.count(); |
39 const SkTextBlobBuilder::RunBuffer* run; | 40 const SkTextBlobBuilder::RunBuffer* run; |
40 | 41 |
41 run = &builder.allocRun(p, glyphCount, 10, 10, NULL); | 42 run = &builder.allocRun(p, glyphCount, 10, 10, NULL); |
42 memcpy(run->glyphs, fGlyphs.begin(), glyphCount * sizeof(uint16_t)); | 43 memcpy(run->glyphs, fGlyphs.begin(), glyphCount * sizeof(uint16_t)); |
43 | 44 |
44 run = &builder.allocRunPosH(p, glyphCount, 80, NULL); | 45 run = &builder.allocRunPosH(p, glyphCount, 80, NULL); |
45 memcpy(run->glyphs, fGlyphs.begin(), glyphCount * sizeof(uint16_t)); | 46 memcpy(run->glyphs, fGlyphs.begin(), glyphCount * sizeof(uint16_t)); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 102 |
102 private: | 103 private: |
103 SkTDArray<uint16_t> fGlyphs; | 104 SkTDArray<uint16_t> fGlyphs; |
104 SkAutoTUnref<const SkTextBlob> fBlob; | 105 SkAutoTUnref<const SkTextBlob> fBlob; |
105 SkAutoTUnref<SkShader> fShader; | 106 SkAutoTUnref<SkShader> fShader; |
106 | 107 |
107 typedef skiagm::GM INHERITED; | 108 typedef skiagm::GM INHERITED; |
108 }; | 109 }; |
109 | 110 |
110 DEF_GM( return SkNEW_ARGS(TextBlobShaderGM, ("Blobber")); ) | 111 DEF_GM( return SkNEW_ARGS(TextBlobShaderGM, ("Blobber")); ) |
OLD | NEW |