Lines Matching refs:fuzz
92 inline T make_fuzz_t(Fuzz* fuzz) { in make_fuzz_t() argument
94 fuzz->next(&t); in make_fuzz_t()
104 static sk_sp<SkColorFilter> make_fuzz_colorfilter(Fuzz* fuzz, int depth) { in make_fuzz_colorfilter() argument
109 fuzz->nextRange(&colorFilterType, 0, 8); in make_fuzz_colorfilter()
116 fuzz->next(&color); in make_fuzz_colorfilter()
117 fuzz->nextRange(&mode, 0, SkBlendMode::kLastMode); in make_fuzz_colorfilter()
121 sk_sp<SkColorFilter> outer = make_fuzz_colorfilter(fuzz, depth - 1); in make_fuzz_colorfilter()
125 sk_sp<SkColorFilter> inner = make_fuzz_colorfilter(fuzz, depth - 1); in make_fuzz_colorfilter()
131 fuzz->nextN(array, SK_ARRAY_COUNT(array)); in make_fuzz_colorfilter()
136 fuzz->next(&mul, &add); in make_fuzz_colorfilter()
143 fuzz->next(&grayscale); in make_fuzz_colorfilter()
144 fuzz->nextRange(&invertStyle, 0, 2); in make_fuzz_colorfilter()
145 fuzz->nextRange(&contrast, -1.0f, 1.0f); in make_fuzz_colorfilter()
153 fuzz->nextN(table, SK_ARRAY_COUNT(table)); in make_fuzz_colorfilter()
161 fuzz->nextN(tableA, SK_ARRAY_COUNT(tableA)); in make_fuzz_colorfilter()
162 fuzz->nextN(tableR, SK_ARRAY_COUNT(tableR)); in make_fuzz_colorfilter()
163 fuzz->nextN(tableG, SK_ARRAY_COUNT(tableG)); in make_fuzz_colorfilter()
164 fuzz->nextN(tableB, SK_ARRAY_COUNT(tableB)); in make_fuzz_colorfilter()
174 static void fuzz_gradient_stops(Fuzz* fuzz, SkScalar* pos, int colorCount) { in fuzz_gradient_stops() argument
177 fuzz->nextRange(&pos[i], 1.0f, 1024.0f); in fuzz_gradient_stops()
188 static sk_sp<SkShader> make_fuzz_shader(Fuzz* fuzz, int depth) { in make_fuzz_shader() argument
202 fuzz->nextRange(&shaderType, 0, 14); in make_fuzz_shader()
209 fuzz->next(&color); in make_fuzz_shader()
212 img = make_fuzz_image(fuzz); in make_fuzz_shader()
213 fuzz->nextRange(&tmX, 0, SkShader::TileMode::kLast_TileMode); in make_fuzz_shader()
214 fuzz->nextRange(&tmY, 0, SkShader::TileMode::kLast_TileMode); in make_fuzz_shader()
215 fuzz->next(&useMatrix); in make_fuzz_shader()
217 FuzzNiceMatrix(fuzz, &matrix); in make_fuzz_shader()
221 bitmap = make_fuzz_bitmap(fuzz); in make_fuzz_shader()
222 fuzz->nextRange(&tmX, 0, SkShader::TileMode::kLast_TileMode); in make_fuzz_shader()
223 fuzz->nextRange(&tmY, 0, SkShader::TileMode::kLast_TileMode); in make_fuzz_shader()
224 fuzz->next(&useMatrix); in make_fuzz_shader()
226 FuzzNiceMatrix(fuzz, &matrix); in make_fuzz_shader()
230 shader1 = make_fuzz_shader(fuzz, depth - 1); // limit recursion. in make_fuzz_shader()
231 FuzzNiceMatrix(fuzz, &matrix); in make_fuzz_shader()
234 shader1 = make_fuzz_shader(fuzz, depth - 1); // limit recursion. in make_fuzz_shader()
235 colorFilter = make_fuzz_colorfilter(fuzz, depth - 1); in make_fuzz_shader()
238 shader1 = make_fuzz_shader(fuzz, depth - 1); // limit recursion. in make_fuzz_shader()
239 shader2 = make_fuzz_shader(fuzz, depth - 1); in make_fuzz_shader()
240 fuzz->nextRange(&blendMode, 0, SkBlendMode::kLastMode); in make_fuzz_shader()
243 auto pic = make_fuzz_picture(fuzz, depth - 1); in make_fuzz_shader()
246 fuzz->nextRange(&tmX, 0, SkShader::TileMode::kLast_TileMode); in make_fuzz_shader()
247 fuzz->nextRange(&tmY, 0, SkShader::TileMode::kLast_TileMode); in make_fuzz_shader()
248 fuzz->next(&useMatrix, &useTile); in make_fuzz_shader()
250 FuzzNiceMatrix(fuzz, &matrix); in make_fuzz_shader()
253 fuzz->next(&tile); in make_fuzz_shader()
270 fuzz->nextN(pts, 2); in make_fuzz_shader()
271 fuzz->nextRange(&colorCount, 2, kMaxColors); in make_fuzz_shader()
272 fuzz->nextN(colors, colorCount); in make_fuzz_shader()
273 fuzz->nextRange(&tmX, 0, SkShader::TileMode::kLast_TileMode); in make_fuzz_shader()
274 fuzz->next(&useMatrix, &usePos); in make_fuzz_shader()
276 FuzzNiceMatrix(fuzz, &matrix); in make_fuzz_shader()
279 fuzz_gradient_stops(fuzz, pos, colorCount); in make_fuzz_shader()
292 fuzz->nextRange(&tmX, 0, SkShader::TileMode::kLast_TileMode); in make_fuzz_shader()
293 fuzz->next(&useMatrix, &usePos, ¢er, &radius); in make_fuzz_shader()
294 fuzz->nextRange(&colorCount, 2, kMaxColors); in make_fuzz_shader()
295 fuzz->nextN(colors, colorCount); in make_fuzz_shader()
297 FuzzNiceMatrix(fuzz, &matrix); in make_fuzz_shader()
300 fuzz_gradient_stops(fuzz, pos, colorCount); in make_fuzz_shader()
313 fuzz->nextRange(&tmX, 0, SkShader::TileMode::kLast_TileMode); in make_fuzz_shader()
314 fuzz->next(&useMatrix, &usePos, &startRadius, &endRadius, &start, &end); in make_fuzz_shader()
315 fuzz->nextRange(&colorCount, 2, kMaxColors); in make_fuzz_shader()
316 fuzz->nextN(colors, colorCount); in make_fuzz_shader()
318 FuzzNiceMatrix(fuzz, &matrix); in make_fuzz_shader()
321 fuzz_gradient_stops(fuzz, pos, colorCount); in make_fuzz_shader()
334 fuzz->next(&cx, &cy, &useMatrix, &usePos); in make_fuzz_shader()
335 fuzz->nextRange(&colorCount, 2, kMaxColors); in make_fuzz_shader()
336 fuzz->nextN(colors, colorCount); in make_fuzz_shader()
338 FuzzNiceMatrix(fuzz, &matrix); in make_fuzz_shader()
341 fuzz_gradient_stops(fuzz, pos, colorCount); in make_fuzz_shader()
351 fuzz->next(&baseFrequencyX, &baseFrequencyY, &seed, &useTileSize, &turbulence); in make_fuzz_shader()
353 fuzz->next(&tileSize); in make_fuzz_shader()
355 fuzz->nextRange(&numOctaves, 2, 7); in make_fuzz_shader()
373 static sk_sp<SkPathEffect> make_fuzz_patheffect(Fuzz* fuzz, int depth) { in make_fuzz_patheffect() argument
378 fuzz->nextRange(&pathEffectType, 0, 8); in make_fuzz_patheffect()
384 sk_sp<SkPathEffect> first = make_fuzz_patheffect(fuzz, depth - 1); in make_fuzz_patheffect()
385 sk_sp<SkPathEffect> second = make_fuzz_patheffect(fuzz, depth - 1); in make_fuzz_patheffect()
389 sk_sp<SkPathEffect> first = make_fuzz_patheffect(fuzz, depth - 1); in make_fuzz_patheffect()
390 sk_sp<SkPathEffect> second = make_fuzz_patheffect(fuzz, depth - 1); in make_fuzz_patheffect()
395 FuzzNicePath(fuzz, &path, 20); in make_fuzz_patheffect()
397 fuzz->next(&advance, &phase); in make_fuzz_patheffect()
399 fuzz->nextRange(&style, 0, SkPath1DPathEffect::kLastEnum_Style); in make_fuzz_patheffect()
405 fuzz->next(&width); in make_fuzz_patheffect()
406 FuzzNiceMatrix(fuzz, &matrix); in make_fuzz_patheffect()
411 FuzzNicePath(fuzz, &path, 20); in make_fuzz_patheffect()
413 FuzzNiceMatrix(fuzz, &matrix); in make_fuzz_patheffect()
418 fuzz->next(&radius); in make_fuzz_patheffect()
423 fuzz->next(&phase); in make_fuzz_patheffect()
426 fuzz->nextRange(&count, 0, (int)SK_ARRAY_COUNT(intervals)); in make_fuzz_patheffect()
427 fuzz->nextN(intervals, count); in make_fuzz_patheffect()
433 fuzz->next(&segLength, &dev, &seed); in make_fuzz_patheffect()
442 static sk_sp<SkMaskFilter> make_fuzz_maskfilter(Fuzz* fuzz) { in make_fuzz_maskfilter() argument
444 fuzz->nextRange(&maskfilterType, 0, 1); in make_fuzz_maskfilter()
450 fuzz->nextRange(&blurStyle, 0, kLastEnum_SkBlurStyle); in make_fuzz_maskfilter()
452 fuzz->next(&sigma); in make_fuzz_maskfilter()
454 fuzz->next(&respectCTM); in make_fuzz_maskfilter()
463 static sk_sp<SkTypeface> make_fuzz_typeface(Fuzz* fuzz) { in make_fuzz_typeface() argument
464 if (make_fuzz_t<bool>(fuzz)) { in make_fuzz_typeface()
471 fuzz->nextRange(&i, 0, familyCount - 1); in make_fuzz_typeface()
474 fuzz->nextRange(&j, 0, styleCount - 1); in make_fuzz_typeface()
478 static sk_sp<SkImageFilter> make_fuzz_imageFilter(Fuzz* fuzz, int depth);
480 static sk_sp<SkImageFilter> make_fuzz_lighting_imagefilter(Fuzz* fuzz, int depth) { in make_fuzz_lighting_imagefilter() argument
485 fuzz->nextRange(&imageFilterType, 1, 6); in make_fuzz_lighting_imagefilter()
492 fuzz->next(&useCropRect); in make_fuzz_lighting_imagefilter()
494 fuzz->next(&cropRect); in make_fuzz_lighting_imagefilter()
498 fuzz->next(&p, &lightColor, &surfaceScale, &k); in make_fuzz_lighting_imagefilter()
499 input = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_lighting_imagefilter()
504 fuzz->next(&p, &lightColor, &surfaceScale, &k); in make_fuzz_lighting_imagefilter()
505 input = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_lighting_imagefilter()
510 fuzz->next(&p, &q, &specularExponent, &cutoffAngle, &lightColor, &surfaceScale, &k); in make_fuzz_lighting_imagefilter()
511 input = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_lighting_imagefilter()
516 fuzz->next(&p, &lightColor, &surfaceScale, &k, &shininess); in make_fuzz_lighting_imagefilter()
517 input = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_lighting_imagefilter()
522 fuzz->next(&p, &lightColor, &surfaceScale, &k, &shininess); in make_fuzz_lighting_imagefilter()
523 input = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_lighting_imagefilter()
528 fuzz->next(&p, &q, &specularExponent, &cutoffAngle, &lightColor, &surfaceScale, &k, in make_fuzz_lighting_imagefilter()
530 input = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_lighting_imagefilter()
540 static void fuzz_paint(Fuzz* fuzz, SkPaint* paint, int depth);
542 static sk_sp<SkImageFilter> make_fuzz_imageFilter(Fuzz* fuzz, int depth) { in make_fuzz_imageFilter() argument
547 fuzz->nextRange(&imageFilterType, 0, 23); in make_fuzz_imageFilter()
553 sk_sp<SkImageFilter> input = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
555 fuzz->next(&sigmaX, &sigmaY, &useCropRect); in make_fuzz_imageFilter()
558 fuzz->next(&cropRect); in make_fuzz_imageFilter()
565 FuzzNiceMatrix(fuzz, &matrix); in make_fuzz_imageFilter()
567 fuzz->nextRange(&quality, 0, SkFilterQuality::kLast_SkFilterQuality); in make_fuzz_imageFilter()
568 sk_sp<SkImageFilter> input = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
574 sk_sp<SkImageFilter> input = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
576 fuzz->next(®ion, &innerMin, &outerMax, &useCropRect); in make_fuzz_imageFilter()
579 fuzz->next(&cropRect); in make_fuzz_imageFilter()
588 fuzz->next(&k1, &k2, &k3, &k4, &enforcePMColor, &useCropRect); in make_fuzz_imageFilter()
589 sk_sp<SkImageFilter> background = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
590 sk_sp<SkImageFilter> foreground = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
593 fuzz->next(&cropRect); in make_fuzz_imageFilter()
600 sk_sp<SkColorFilter> cf = make_fuzz_colorfilter(fuzz, depth - 1); in make_fuzz_imageFilter()
601 sk_sp<SkImageFilter> input = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
604 fuzz->next(&useCropRect); in make_fuzz_imageFilter()
606 fuzz->next(&cropRect); in make_fuzz_imageFilter()
612 sk_sp<SkImageFilter> ifo = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
613 sk_sp<SkImageFilter> ifi = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
618 fuzz->nextRange(&xChannelSelector, 1, 4); in make_fuzz_imageFilter()
619 fuzz->nextRange(&yChannelSelector, 1, 4); in make_fuzz_imageFilter()
622 fuzz->next(&scale, &useCropRect); in make_fuzz_imageFilter()
625 fuzz->next(&cropRect); in make_fuzz_imageFilter()
627 sk_sp<SkImageFilter> displacement = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
628 sk_sp<SkImageFilter> color = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
637 fuzz->nextRange(&shadowMode, 0, 1); in make_fuzz_imageFilter()
639 fuzz->next(&dx, &dy, &sigmaX, &sigmaY, &color, &useCropRect); in make_fuzz_imageFilter()
642 fuzz->next(&cropRect); in make_fuzz_imageFilter()
644 sk_sp<SkImageFilter> input = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
650 return SkImageSource::Make(make_fuzz_image(fuzz)); in make_fuzz_imageFilter()
652 sk_sp<SkImage> image = make_fuzz_image(fuzz); in make_fuzz_imageFilter()
655 fuzz->next(&srcRect, &dstRect); in make_fuzz_imageFilter()
656 fuzz->nextRange(&filterQuality, 0, SkFilterQuality::kLast_SkFilterQuality); in make_fuzz_imageFilter()
660 return make_fuzz_lighting_imagefilter(fuzz, depth - 1); in make_fuzz_imageFilter()
666 fuzz->next(&srcRect, &inset, &useCropRect); in make_fuzz_imageFilter()
668 fuzz->next(&cropRect); in make_fuzz_imageFilter()
670 sk_sp<SkImageFilter> input = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
677 fuzz->nextRange(&n, 1, kMaxKernelSize); in make_fuzz_imageFilter()
678 fuzz->nextRange(&m, 1, kMaxKernelSize); in make_fuzz_imageFilter()
680 fuzz->nextN(kernel, n * m); in make_fuzz_imageFilter()
682 fuzz->nextRange(&offsetX, 0, n - 1); in make_fuzz_imageFilter()
683 fuzz->nextRange(&offsetY, 0, m - 1); in make_fuzz_imageFilter()
686 fuzz->next(&gain, &bias, &convolveAlpha, &useCropRect); in make_fuzz_imageFilter()
688 fuzz->nextRange(&tileMode, 0, SkMatrixConvolutionImageFilter::TileMode::kLast_TileMode); in make_fuzz_imageFilter()
691 fuzz->next(&cropRect); in make_fuzz_imageFilter()
693 sk_sp<SkImageFilter> input = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
699 sk_sp<SkImageFilter> first = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
700 sk_sp<SkImageFilter> second = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
702 fuzz->next(&useCropRect); in make_fuzz_imageFilter()
705 fuzz->next(&cropRect); in make_fuzz_imageFilter()
714 fuzz->nextRange(&count, 1, kMaxCount); in make_fuzz_imageFilter()
716 ifs[i] = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
719 fuzz->next(&useCropRect); in make_fuzz_imageFilter()
722 fuzz->next(&cropRect); in make_fuzz_imageFilter()
728 fuzz->next(&rx, &ry); in make_fuzz_imageFilter()
730 fuzz->next(&useCropRect); in make_fuzz_imageFilter()
733 fuzz->next(&cropRect); in make_fuzz_imageFilter()
735 sk_sp<SkImageFilter> input = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
741 fuzz->next(&rx, &ry); in make_fuzz_imageFilter()
743 fuzz->next(&useCropRect); in make_fuzz_imageFilter()
746 fuzz->next(&cropRect); in make_fuzz_imageFilter()
748 sk_sp<SkImageFilter> input = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
754 fuzz->next(&dx, &dy); in make_fuzz_imageFilter()
756 fuzz->next(&useCropRect); in make_fuzz_imageFilter()
759 fuzz->next(&cropRect); in make_fuzz_imageFilter()
761 sk_sp<SkImageFilter> input = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
767 fuzz_paint(fuzz, &paint, depth - 1); in make_fuzz_imageFilter()
769 fuzz->next(&useCropRect); in make_fuzz_imageFilter()
772 fuzz->next(&cropRect); in make_fuzz_imageFilter()
777 sk_sp<SkPicture> picture = make_fuzz_picture(fuzz, depth - 1); in make_fuzz_imageFilter()
782 fuzz->next(&cropRect); in make_fuzz_imageFilter()
783 sk_sp<SkPicture> picture = make_fuzz_picture(fuzz, depth - 1); in make_fuzz_imageFilter()
788 fuzz->next(&src, &dst); in make_fuzz_imageFilter()
789 sk_sp<SkImageFilter> input = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
795 fuzz->next(&useCropRect); in make_fuzz_imageFilter()
796 fuzz->nextRange(&blendMode, 0, SkBlendMode::kLastMode); in make_fuzz_imageFilter()
799 fuzz->next(&cropRect); in make_fuzz_imageFilter()
801 sk_sp<SkImageFilter> bg = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
802 sk_sp<SkImageFilter> fg = make_fuzz_imageFilter(fuzz, depth - 1); in make_fuzz_imageFilter()
812 static sk_sp<SkImage> make_fuzz_image(Fuzz* fuzz) { in make_fuzz_image() argument
814 fuzz->nextRange(&w, 1, 1024); in make_fuzz_image()
815 fuzz->nextRange(&h, 1, 1024); in make_fuzz_image()
821 fuzz->next(&c); in make_fuzz_image()
829 static SkBitmap make_fuzz_bitmap(Fuzz* fuzz) { in make_fuzz_bitmap() argument
832 fuzz->nextRange(&w, 1, 1024); in make_fuzz_bitmap()
833 fuzz->nextRange(&h, 1, 1024); in make_fuzz_bitmap()
841 fuzz->next(&c); in make_fuzz_bitmap()
849 inline T make_fuzz_t_range(Fuzz* fuzz, Min minv, Max maxv) { in make_fuzz_t_range() argument
851 fuzz->nextRange(&value, minv, maxv); in make_fuzz_t_range()
855 static void fuzz_paint(Fuzz* fuzz, SkPaint* paint, int depth) { in fuzz_paint() argument
856 if (!fuzz || !paint || depth <= 0) { in fuzz_paint()
860 paint->setAntiAlias( make_fuzz_t<bool>(fuzz)); in fuzz_paint()
861 paint->setDither( make_fuzz_t<bool>(fuzz)); in fuzz_paint()
862 paint->setColor( make_fuzz_t<SkColor>(fuzz)); in fuzz_paint()
863 paint->setBlendMode( make_fuzz_t_range<SkBlendMode>(fuzz, 0, SkBlendMode::kLastMode)); in fuzz_paint()
864 paint->setFilterQuality(make_fuzz_t_range<SkFilterQuality>(fuzz, 0, kLast_SkFilterQuality)); in fuzz_paint()
865 paint->setStyle( make_fuzz_t_range<SkPaint::Style>(fuzz, 0, 2)); in fuzz_paint()
866 paint->setShader( make_fuzz_shader(fuzz, depth - 1)); in fuzz_paint()
867 paint->setPathEffect( make_fuzz_patheffect(fuzz, depth - 1)); in fuzz_paint()
868 paint->setMaskFilter( make_fuzz_maskfilter(fuzz)); in fuzz_paint()
869 paint->setImageFilter( make_fuzz_imageFilter(fuzz, depth - 1)); in fuzz_paint()
870 paint->setColorFilter( make_fuzz_colorfilter(fuzz, depth - 1)); in fuzz_paint()
873 paint->setStrokeWidth(make_fuzz_t<SkScalar>(fuzz)); in fuzz_paint()
874 paint->setStrokeMiter(make_fuzz_t<SkScalar>(fuzz)); in fuzz_paint()
875 paint->setStrokeCap( make_fuzz_t_range<SkPaint::Cap>(fuzz, 0, SkPaint::kLast_Cap)); in fuzz_paint()
876 paint->setStrokeJoin( make_fuzz_t_range<SkPaint::Join>(fuzz, 0, SkPaint::kLast_Join)); in fuzz_paint()
880 static SkFont fuzz_font(Fuzz* fuzz) { in fuzz_font() argument
882 font.setTypeface( make_fuzz_typeface(fuzz)); in fuzz_font()
883 font.setSize( make_fuzz_t<SkScalar>(fuzz)); in fuzz_font()
884 font.setScaleX( make_fuzz_t<SkScalar>(fuzz)); in fuzz_font()
885 font.setSkewX( make_fuzz_t<SkScalar>(fuzz)); in fuzz_font()
886 font.setLinearMetrics( make_fuzz_t<bool>(fuzz)); in fuzz_font()
887 font.setSubpixel( make_fuzz_t<bool>(fuzz)); in fuzz_font()
888 font.setEmbeddedBitmaps( make_fuzz_t<bool>(fuzz)); in fuzz_font()
889 font.setForceAutoHinting( make_fuzz_t<bool>(fuzz)); in fuzz_font()
890 font.setEmbolden( make_fuzz_t<bool>(fuzz)); in fuzz_font()
891 font.setHinting( make_fuzz_t_range<SkFontHinting>(fuzz, 0, kFull_SkFontHinting)); in fuzz_font()
892 font.setEdging( make_fuzz_t_range<SkFont::Edging>(fuzz, 0, in fuzz_font()
897 static SkTextEncoding fuzz_paint_text_encoding(Fuzz* fuzz) { in fuzz_paint_text_encoding() argument
898 return make_fuzz_t_range<SkTextEncoding>(fuzz, 0, 3); in fuzz_paint_text_encoding()
903 static SkTDArray<uint8_t> make_fuzz_text(Fuzz* fuzz, const SkFont& font, SkTextEncoding encoding) { in make_fuzz_text() argument
913 fuzz->nextRange(&glyphCount, 1, kMaxGlyphCount); in make_fuzz_text()
916 fuzz->nextRange(&glyphs[i], 0, glyphRange - 1); in make_fuzz_text()
932 fuzz->nextRange(&length, 1, kMaxLength); in make_fuzz_text()
935 fuzz->nextRange(&value, 0, count - 1); in make_fuzz_text()
976 static sk_sp<SkTextBlob> make_fuzz_textblob(Fuzz* fuzz) { in make_fuzz_textblob() argument
979 fuzz->nextRange(&runCount, (int8_t)1, (int8_t)8); in make_fuzz_textblob()
982 SkTextEncoding encoding = fuzz_paint_text_encoding(fuzz); in make_fuzz_textblob()
983 … font.setEdging(make_fuzz_t<bool>(fuzz) ? SkFont::Edging::kAlias : SkFont::Edging::kAntiAlias); in make_fuzz_textblob()
984 SkTDArray<uint8_t> text = make_fuzz_text(fuzz, font, encoding); in make_fuzz_textblob()
990 fuzz->nextRange(&runType, (uint8_t)0, (uint8_t)2); in make_fuzz_textblob()
995 fuzz->next(&x, &y); in make_fuzz_textblob()
1001 fuzz->next(&y); in make_fuzz_textblob()
1005 fuzz->nextN(buffer->pos, glyphCount); in make_fuzz_textblob()
1011 fuzz->nextN(buffer->pos, glyphCount * 2); in make_fuzz_textblob()
1024 static void fuzz_canvas(Fuzz* fuzz, SkCanvas* canvas, int depth = 9) { in fuzz_canvas() argument
1025 if (!fuzz || !canvas || depth <= 0) { in fuzz_canvas()
1030 fuzz->next(&useDAA); in fuzz_canvas()
1036 fuzz->nextRange(&N, 0, 2000); in fuzz_canvas()
1038 if (fuzz->exhausted()) { in fuzz_canvas()
1044 fuzz->nextRange(&drawCommand, 0, 53); in fuzz_canvas()
1054 fuzz->next(&bounds); in fuzz_canvas()
1055 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1061 fuzz->next(&bounds); in fuzz_canvas()
1066 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1074 fuzz->next(&alpha); in fuzz_canvas()
1081 fuzz->next(&bounds, &alpha); in fuzz_canvas()
1088 if (make_fuzz_t<bool>(fuzz)) { in fuzz_canvas()
1089 fuzz->next(&bounds); in fuzz_canvas()
1092 if (make_fuzz_t<bool>(fuzz)) { in fuzz_canvas()
1093 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1097 if (make_fuzz_t<bool>(fuzz)) { in fuzz_canvas()
1098 imageFilter = make_fuzz_imageFilter(fuzz, depth - 1); in fuzz_canvas()
1114 fuzz->next(&saveCount); in fuzz_canvas()
1120 fuzz->next(&x, &y); in fuzz_canvas()
1126 fuzz->next(&x, &y); in fuzz_canvas()
1132 fuzz->next(&v); in fuzz_canvas()
1138 fuzz->next(&x, &y, &v); in fuzz_canvas()
1144 fuzz->next(&x, &y); in fuzz_canvas()
1150 FuzzNiceMatrix(fuzz, &mat); in fuzz_canvas()
1156 FuzzNiceMatrix(fuzz, &mat); in fuzz_canvas()
1167 fuzz->next(&r, &doAntiAlias); in fuzz_canvas()
1168 fuzz->nextRange(&op, 0, 1); in fuzz_canvas()
1177 FuzzNiceRRect(fuzz, &rr); in fuzz_canvas()
1178 fuzz->next(&doAntiAlias); in fuzz_canvas()
1179 fuzz->nextRange(&op, 0, 1); in fuzz_canvas()
1185 FuzzNicePath(fuzz, &path, 30); in fuzz_canvas()
1188 fuzz->next(&doAntiAlias); in fuzz_canvas()
1189 fuzz->nextRange(&op, 0, 1); in fuzz_canvas()
1196 fuzz->next(®ion); in fuzz_canvas()
1197 fuzz->nextRange(&op, 0, 1); in fuzz_canvas()
1202 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1206 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1208 fuzz->nextRange(&pointMode, in fuzz_canvas()
1212 fuzz->nextRange(&count, 0, kMaxCount); in fuzz_canvas()
1214 fuzz->nextN(pts, count); in fuzz_canvas()
1219 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1221 fuzz->next(&r); in fuzz_canvas()
1229 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1231 fuzz->next(®ion); in fuzz_canvas()
1236 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1238 fuzz->next(&r); in fuzz_canvas()
1247 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1249 FuzzNiceRRect(fuzz, &rr); in fuzz_canvas()
1254 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1256 FuzzNiceRRect(fuzz, &orr); in fuzz_canvas()
1257 FuzzNiceRRect(fuzz, &irr); in fuzz_canvas()
1264 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1268 fuzz->next(&r, &start, &sweep, &useCenter); in fuzz_canvas()
1273 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1275 FuzzNicePath(fuzz, &path, 60); in fuzz_canvas()
1280 sk_sp<SkImage> img = make_fuzz_image(fuzz); in fuzz_canvas()
1283 fuzz->next(&left, &top, &usePaint); in fuzz_canvas()
1285 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1291 auto img = make_fuzz_image(fuzz); in fuzz_canvas()
1294 fuzz->next(&src, &dst, &usePaint); in fuzz_canvas()
1296 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1302 auto img = make_fuzz_image(fuzz); in fuzz_canvas()
1306 fuzz->next(&src, &dst, &usePaint); in fuzz_canvas()
1308 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1311 make_fuzz_t<bool>(fuzz) ? SkCanvas::kStrict_SrcRectConstraint in fuzz_canvas()
1318 auto img = make_fuzz_image(fuzz); in fuzz_canvas()
1320 fuzz->next(&dst, &usePaint); in fuzz_canvas()
1322 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1328 auto img = make_fuzz_image(fuzz); in fuzz_canvas()
1332 fuzz->next(&usePaint); in fuzz_canvas()
1334 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1336 if (make_fuzz_t<bool>(fuzz)) { in fuzz_canvas()
1337 fuzz->next(¢er); in fuzz_canvas()
1339 fuzz->nextRange(¢er.fLeft, 0, img->width() - 1); in fuzz_canvas()
1340 fuzz->nextRange(¢er.fTop, 0, img->height() - 1); in fuzz_canvas()
1341 fuzz->nextRange(¢er.fRight, center.fLeft + 1, img->width()); in fuzz_canvas()
1342 fuzz->nextRange(¢er.fBottom, center.fTop + 1, img->height()); in fuzz_canvas()
1344 fuzz->next(&dst); in fuzz_canvas()
1349 SkBitmap bitmap = make_fuzz_bitmap(fuzz); in fuzz_canvas()
1352 fuzz->next(&left, &top, &usePaint); in fuzz_canvas()
1354 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1360 SkBitmap bitmap = make_fuzz_bitmap(fuzz); in fuzz_canvas()
1363 fuzz->next(&src, &dst, &usePaint); in fuzz_canvas()
1365 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1368 make_fuzz_t<bool>(fuzz) ? SkCanvas::kStrict_SrcRectConstraint in fuzz_canvas()
1374 SkBitmap img = make_fuzz_bitmap(fuzz); in fuzz_canvas()
1378 fuzz->next(&src, &dst, &usePaint); in fuzz_canvas()
1380 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1383 make_fuzz_t<bool>(fuzz) ? SkCanvas::kStrict_SrcRectConstraint in fuzz_canvas()
1389 SkBitmap img = make_fuzz_bitmap(fuzz); in fuzz_canvas()
1392 fuzz->next(&dst, &usePaint); in fuzz_canvas()
1394 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1397 make_fuzz_t<bool>(fuzz) ? SkCanvas::kStrict_SrcRectConstraint in fuzz_canvas()
1403 SkBitmap img = make_fuzz_bitmap(fuzz); in fuzz_canvas()
1407 fuzz->next(&usePaint); in fuzz_canvas()
1409 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1411 if (make_fuzz_t<bool>(fuzz)) { in fuzz_canvas()
1412 fuzz->next(¢er); in fuzz_canvas()
1418 fuzz->nextRange(¢er.fLeft, 0, img.width() - 1); in fuzz_canvas()
1419 fuzz->nextRange(¢er.fTop, 0, img.height() - 1); in fuzz_canvas()
1420 fuzz->nextRange(¢er.fRight, center.fLeft + 1, img.width()); in fuzz_canvas()
1421 fuzz->nextRange(¢er.fBottom, center.fTop + 1, img.height()); in fuzz_canvas()
1423 fuzz->next(&dst); in fuzz_canvas()
1428 SkBitmap img = make_fuzz_bitmap(fuzz); in fuzz_canvas()
1431 fuzz->next(&usePaint, &dst); in fuzz_canvas()
1433 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1438 fuzz->nextRange(&lattice.fXCount, 2, kMax); in fuzz_canvas()
1439 fuzz->nextRange(&lattice.fYCount, 2, kMax); in fuzz_canvas()
1440 fuzz->nextN(xDivs, lattice.fXCount); in fuzz_canvas()
1441 fuzz->nextN(yDivs, lattice.fYCount); in fuzz_canvas()
1446 auto img = make_fuzz_image(fuzz); in fuzz_canvas()
1449 fuzz->next(&usePaint, &dst); in fuzz_canvas()
1451 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1456 fuzz->nextRange(&lattice.fXCount, 2, kMax); in fuzz_canvas()
1457 fuzz->nextRange(&lattice.fYCount, 2, kMax); in fuzz_canvas()
1458 fuzz->nextN(xDivs, lattice.fXCount); in fuzz_canvas()
1459 fuzz->nextN(yDivs, lattice.fYCount); in fuzz_canvas()
1464 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1465 font = fuzz_font(fuzz); in fuzz_canvas()
1466 SkTextEncoding encoding = fuzz_paint_text_encoding(fuzz); in fuzz_canvas()
1468 fuzz->next(&x, &y); in fuzz_canvas()
1469 SkTDArray<uint8_t> text = make_fuzz_text(fuzz, font, encoding); in fuzz_canvas()
1495 sk_sp<SkTextBlob> blob = make_fuzz_textblob(fuzz); in fuzz_canvas()
1496 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1498 fuzz->next(&x, &y); in fuzz_canvas()
1505 fuzz->next(&usePaint, &useMatrix); in fuzz_canvas()
1507 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1510 FuzzNiceMatrix(fuzz, &matrix); in fuzz_canvas()
1512 auto pic = make_fuzz_picture(fuzz, depth - 1); in fuzz_canvas()
1518 fuzz_paint(fuzz, &paint, depth - 1); in fuzz_canvas()
1521 fuzz->nextRange(&vertexMode, 0, SkVertices::kTriangleFan_VertexMode); in fuzz_canvas()
1522 fuzz->nextRange(&blendMode, 0, SkBlendMode::kLastMode); in fuzz_canvas()
1528 fuzz->nextRange(&vertexCount, 3, kMaxCount); in fuzz_canvas()
1529 fuzz->nextN(vertices, vertexCount); in fuzz_canvas()
1531 fuzz->next(&useTexs, &useColors); in fuzz_canvas()
1533 fuzz->nextN(texs, vertexCount); in fuzz_canvas()
1536 fuzz->nextN(colors, vertexCount); in fuzz_canvas()
1540 if (make_fuzz_t<bool>(fuzz)) { in fuzz_canvas()
1541 fuzz->nextRange(&indexCount, vertexCount, vertexCount + kMaxCount); in fuzz_canvas()
1543 fuzz->nextRange(&indices[i], 0, vertexCount - 1); in fuzz_canvas()
1560 static sk_sp<SkPicture> make_fuzz_picture(Fuzz* fuzz, int depth) { in make_fuzz_picture() argument
1562 fuzz->next(&w, &h); in make_fuzz_picture()
1564 fuzz_canvas(fuzz, pictureRecorder.beginRecording(w, h), depth - 1); in make_fuzz_picture()
1568 DEF_FUZZ(NullCanvas, fuzz) { in DEF_FUZZ() argument
1569 fuzz_canvas(fuzz, SkMakeNullCanvas().get()); in DEF_FUZZ()
1574 DEF_FUZZ(RasterN32Canvas, fuzz) { in DEF_FUZZ() argument
1576 if (!surface || !surface->getCanvas()) { fuzz->signalBug(); } in DEF_FUZZ()
1577 fuzz_canvas(fuzz, surface->getCanvas()); in DEF_FUZZ()
1580 DEF_FUZZ(RasterN32CanvasViaSerialization, fuzz) { in DEF_FUZZ() argument
1582 fuzz_canvas(fuzz, recorder.beginRecording(SkIntToScalar(kCanvasSize.width()), in DEF_FUZZ()
1585 if (!pic) { fuzz->signalBug(); } in DEF_FUZZ()
1587 if (!data) { fuzz->signalBug(); } in DEF_FUZZ()
1590 if (!deserialized) { fuzz->signalBug(); } in DEF_FUZZ()
1596 DEF_FUZZ(ImageFilter, fuzz) { in DEF_FUZZ() argument
1597 auto fil = make_fuzz_imageFilter(fuzz, 20); in DEF_FUZZ()
1610 DEF_FUZZ(SerializedImageFilter, fuzz) { in DEF_FUZZ() argument
1611 auto filter = make_fuzz_imageFilter(fuzz, 20); in DEF_FUZZ()
1622 fuzz->nextRange(&j, 1, 250); in DEF_FUZZ()
1625 fuzz->nextRange(&k, 1, 10); in DEF_FUZZ()
1628 fuzz->nextRange(&s, 0, 2); in DEF_FUZZ()
1642 fuzz->nextRange(&s, 0, 7); in DEF_FUZZ()
1681 static void fuzz_ganesh(Fuzz* fuzz, GrContext* context) { in fuzz_ganesh() argument
1688 fuzz_canvas(fuzz, surface->getCanvas()); in fuzz_ganesh()
1691 DEF_FUZZ(NativeGLCanvas, fuzz) { in DEF_FUZZ() argument
1700 fuzz_ganesh(fuzz, context); in DEF_FUZZ()
1705 DEF_FUZZ(NullGLCanvas, fuzz) { in DEF_FUZZ() argument
1707 fuzz_ganesh(fuzz, f.get(sk_gpu_test::GrContextFactory::kNullGL_ContextType)); in DEF_FUZZ()
1710 DEF_FUZZ(MockGPUCanvas, fuzz) { in DEF_FUZZ() argument
1712 fuzz_ganesh(fuzz, f.get(sk_gpu_test::GrContextFactory::kMock_ContextType)); in DEF_FUZZ()
1716 DEF_FUZZ(PDFCanvas, fuzz) { in DEF_FUZZ() argument
1719 fuzz_canvas(fuzz, doc->beginPage(SkIntToScalar(kCanvasSize.width()), in DEF_FUZZ()
1724 DEF_FUZZ(_DumpCanvas, fuzz) { in DEF_FUZZ() argument
1726 fuzz_canvas(fuzz, &debugCanvas); in DEF_FUZZ()