163 {
164 struct AliasType {
166 bool inLayer;
167 } constexpr aliasTypes[] {
168#ifndef SK_BUILD_FOR_IOS
169
170
171
172
173
174
175
176
177
178
180#endif
185 };
186
187
188
189
190
191
192
193
194
195
196 constexpr SkScalar textSizes[] = { 9, 10, 11, 12, 13, 14, 15, 16 };
197
203 };
204
205 struct SubpixelType {
206 bool requested;
208 } constexpr subpixelTypes[] = {
209 { false, { 0.00, 0.00 } },
210 {
true , { 0.00, 0.00 } },
211 {
true , { 0.25, 0.00 } },
212 {
true , { 0.25, 0.25 } },
213 };
214
215 constexpr bool rotateABitTypes[] = { false, true };
216
218 {
220
222 font.setEmbeddedBitmaps(
true);
223
227 for (const SubpixelType subpixel : subpixelTypes) {
229 font.setSubpixel(subpixel.requested);
230
231 for (const AliasType& alias : aliasTypes) {
232 font.setEdging(alias.edging);
234 if (alias.inLayer) {
236 }
237
238 for (
const SkScalar& textSize : textSizes) {
240 font.setSize(textSize);
241
245 font.setHinting(hinting);
246
247 for (const bool& rotateABit : rotateABitTypes) {
249 if (rotateABit) {
250 canvas->
rotate(2,
x + subpixel.offset.x(),
251 y + subpixel.offset.y());
252 }
254 x + subpixel.offset.x(),
256
261 }
262 }
263 }
265 }
266 xBase = xMax;
267 }
268 }
269
270 constexpr struct StyleTests {
273 } styleTypes[] = {
278 };
279
280 constexpr bool fakeBoldTypes[] = { false, true };
281
282 {
284
286
288 for (const bool& fakeBold : fakeBoldTypes) {
292
293 font.setEmbolden(fakeBold);
294 for (const AliasType& alias : aliasTypes) {
295 font.setEdging(alias.edging);
297 if (alias.inLayer) {
299 }
300 for (const StyleTests& style : styleTypes) {
301 paint.setStyle(style.style);
302 paint.setStrokeWidth(style.strokeWidth);
305
309 }
310 }
312 }
313 }
314
315 constexpr struct MaskTests {
318 } maskTypes[] = {
323
328
333 };
334
335 {
337
339
341 {
342 for (const AliasType& alias : aliasTypes) {
346
347 font.setEdging(alias.edging);
349 if (alias.inLayer) {
351 }
352 for (const MaskTests& mask : maskTypes) {
356
360 }
361 paint.setMaskFilter(
nullptr);
362 }
364 }
365 }
366}
static const int strokeWidth
@ kOuter_SkBlurStyle
nothing inside, fuzzy outside
@ kSolid_SkBlurStyle
solid inside, fuzzy outside
@ kInner_SkBlurStyle
fuzzy inside, nothing outside
@ kNormal_SkBlurStyle
fuzzy inside and outside
@ kNormal
glyph outlines modified to improve constrast
@ kNone
glyph outlines unchanged
@ kSlight
minimal modification to improve constrast
@ kFull
modifies glyph outlines for maximum constrast
@ kGlyphID
uses two byte words to represent glyph indices
#define SkScalarCeilToScalar(x)
int saveLayer(const SkRect *bounds, const SkPaint *paint)
void drawSimpleText(const void *text, size_t byteLength, SkTextEncoding encoding, SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
void rotate(SkScalar degrees)
@ kAlias
no transparent pixels on glyph edges
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
static float max(float r, float g, float b)
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx