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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 sk_tool_utils::add_to_text_blob(&builder, text, paint, 0, yOffset); | 73 sk_tool_utils::add_to_text_blob(&builder, text, paint, 0, yOffset); |
74 | 74 |
75 // Zero size. | 75 // Zero size. |
76 paint.measureText(text, strlen(text), &bounds); | 76 paint.measureText(text, strlen(text), &bounds); |
77 yOffset += bounds.height(); | 77 yOffset += bounds.height(); |
78 paint.setTextSize(0); | 78 paint.setTextSize(0); |
79 | 79 |
80 sk_tool_utils::add_to_text_blob(&builder, text, paint, 0, yOffset); | 80 sk_tool_utils::add_to_text_blob(&builder, text, paint, 0, yOffset); |
81 | 81 |
82 // build | 82 // build |
83 fBlob.reset(builder.build()); | 83 fBlob = builder.make(); |
84 } | 84 } |
85 | 85 |
86 SkString onShortName() override { | 86 SkString onShortName() override { |
87 SkString name("textblobmixedsizes"); | 87 SkString name("textblobmixedsizes"); |
88 if (fUseDFT) { | 88 if (fUseDFT) { |
89 name.appendf("_df"); | 89 name.appendf("_df"); |
90 } | 90 } |
91 return name; | 91 return name; |
92 } | 92 } |
93 | 93 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 if (surface) { | 170 if (surface) { |
171 SkAutoCanvasRestore acr(inputCanvas, true); | 171 SkAutoCanvasRestore acr(inputCanvas, true); |
172 // since we prepended this matrix already, we blit using identity | 172 // since we prepended this matrix already, we blit using identity |
173 inputCanvas->resetMatrix(); | 173 inputCanvas->resetMatrix(); |
174 inputCanvas->drawImage(surface->makeImageSnapshot().get(), 0, 0, nul
lptr); | 174 inputCanvas->drawImage(surface->makeImageSnapshot().get(), 0, 0, nul
lptr); |
175 } | 175 } |
176 #endif | 176 #endif |
177 } | 177 } |
178 | 178 |
179 private: | 179 private: |
180 SkAutoTUnref<const SkTextBlob> fBlob; | 180 sk_sp<SkTextBlob> fBlob; |
181 | 181 |
182 static constexpr int kWidth = 2100; | 182 static constexpr int kWidth = 2100; |
183 static constexpr int kHeight = 1900; | 183 static constexpr int kHeight = 1900; |
184 | 184 |
185 bool fUseDFT; | 185 bool fUseDFT; |
186 | 186 |
187 typedef GM INHERITED; | 187 typedef GM INHERITED; |
188 }; | 188 }; |
189 | 189 |
190 ////////////////////////////////////////////////////////////////////////////// | 190 ////////////////////////////////////////////////////////////////////////////// |
191 | 191 |
192 DEF_GM( return new TextBlobMixedSizes(false); ) | 192 DEF_GM( return new TextBlobMixedSizes(false); ) |
193 #if SK_SUPPORT_GPU | 193 #if SK_SUPPORT_GPU |
194 DEF_GM( return new TextBlobMixedSizes(true); ) | 194 DEF_GM( return new TextBlobMixedSizes(true); ) |
195 #endif | 195 #endif |
196 } | 196 } |
OLD | NEW |