OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // The mac emoji string will break us | 70 // The mac emoji string will break us |
71 if (origEmoji && (!strcmp(osName, "Android") || !strcmp(osName, "Ubuntu"
))) { | 71 if (origEmoji && (!strcmp(osName, "Android") || !strcmp(osName, "Ubuntu"
))) { |
72 const char* emojiText = sk_tool_utils::emoji_sample_text(); | 72 const char* emojiText = sk_tool_utils::emoji_sample_text(); |
73 paint.measureText(emojiText, strlen(emojiText), &bounds); | 73 paint.measureText(emojiText, strlen(emojiText), &bounds); |
74 offset += bounds.height(); | 74 offset += bounds.height(); |
75 paint.setTypeface(sk_make_sp<SkRandomTypeface>(orig, paint, false)); | 75 paint.setTypeface(sk_make_sp<SkRandomTypeface>(orig, paint, false)); |
76 sk_tool_utils::add_to_text_blob(&builder, emojiText, paint, 0, offse
t); | 76 sk_tool_utils::add_to_text_blob(&builder, emojiText, paint, 0, offse
t); |
77 } | 77 } |
78 | 78 |
79 // build | 79 // build |
80 fBlob.reset(builder.build()); | 80 fBlob = builder.make(); |
81 } | 81 } |
82 | 82 |
83 SkString onShortName() override { | 83 SkString onShortName() override { |
84 return SkString("textblobrandomfont"); | 84 return SkString("textblobrandomfont"); |
85 } | 85 } |
86 | 86 |
87 SkISize onISize() override { | 87 SkISize onISize() override { |
88 return SkISize::Make(kWidth, kHeight); | 88 return SkISize::Make(kWidth, kHeight); |
89 } | 89 } |
90 | 90 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 } else { | 130 } else { |
131 const char* text = "This test requires a surface"; | 131 const char* text = "This test requires a surface"; |
132 size_t len = strlen(text); | 132 size_t len = strlen(text); |
133 SkPaint paint; | 133 SkPaint paint; |
134 canvas->drawText(text, len, 10, 100, paint); | 134 canvas->drawText(text, len, 10, 100, paint); |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 private: | 138 private: |
139 SkAutoTUnref<const SkTextBlob> fBlob; | 139 sk_sp<SkTextBlob> fBlob; |
140 | 140 |
141 static constexpr int kWidth = 2000; | 141 static constexpr int kWidth = 2000; |
142 static constexpr int kHeight = 1600; | 142 static constexpr int kHeight = 1600; |
143 | 143 |
144 typedef GM INHERITED; | 144 typedef GM INHERITED; |
145 }; | 145 }; |
146 | 146 |
147 ////////////////////////////////////////////////////////////////////////////// | 147 ////////////////////////////////////////////////////////////////////////////// |
148 | 148 |
149 DEF_GM(return new TextBlobRandomFont;) | 149 DEF_GM(return new TextBlobRandomFont;) |
150 } | 150 } |
151 #endif | 151 #endif |
OLD | NEW |