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" |
11 #include "SkGradientShader.h" | 11 #include "SkGradientShader.h" |
12 #include "SkPoint.h" | 12 #include "SkPoint.h" |
13 #include "SkShader.h" | 13 #include "SkShader.h" |
14 #include "SkTextBlob.h" | 14 #include "SkTextBlob.h" |
15 #include "SkTDArray.h" | 15 #include "SkTDArray.h" |
16 #include "SkTypeface.h" | 16 #include "SkTypeface.h" |
17 | 17 |
18 // This GM exercises drawTextBlob offset vs. shader space behavior. | 18 // This GM exercises drawTextBlob offset vs. shader space behavior. |
19 class TextBlobShaderGM : public skiagm::GM { | 19 class TextBlobShaderGM : public skiagm::GM { |
20 public: | 20 public: |
21 TextBlobShaderGM(const char* txt) { | 21 TextBlobShaderGM(const char* txt) { |
22 SkPaint p; | 22 SkPaint p; |
| 23 sk_tool_utils::set_portable_typeface(&p); |
23 size_t txtLen = strlen(txt); | 24 size_t txtLen = strlen(txt); |
24 fGlyphs.append(p.textToGlyphs(txt, txtLen, NULL)); | 25 fGlyphs.append(p.textToGlyphs(txt, txtLen, NULL)); |
25 p.textToGlyphs(txt, txtLen, fGlyphs.begin()); | 26 p.textToGlyphs(txt, txtLen, fGlyphs.begin()); |
26 } | 27 } |
27 | 28 |
28 protected: | 29 protected: |
29 | 30 |
30 void onOnceBeforeDraw() override { | 31 void onOnceBeforeDraw() override { |
31 SkPaint p; | 32 SkPaint p; |
32 p.setAntiAlias(true); | 33 p.setAntiAlias(true); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 103 |
103 private: | 104 private: |
104 SkTDArray<uint16_t> fGlyphs; | 105 SkTDArray<uint16_t> fGlyphs; |
105 SkAutoTUnref<const SkTextBlob> fBlob; | 106 SkAutoTUnref<const SkTextBlob> fBlob; |
106 SkAutoTUnref<SkShader> fShader; | 107 SkAutoTUnref<SkShader> fShader; |
107 | 108 |
108 typedef skiagm::GM INHERITED; | 109 typedef skiagm::GM INHERITED; |
109 }; | 110 }; |
110 | 111 |
111 DEF_GM( return SkNEW_ARGS(TextBlobShaderGM, ("Blobber")); ) | 112 DEF_GM( return SkNEW_ARGS(TextBlobShaderGM, ("Blobber")); ) |
OLD | NEW |