Lines Matching full:rand

351 const skcms_TransferFunction& random_xfer_function(SkRandom* rand) {  in random_xfer_function()  argument
352 return gTransferFunctions[rand->nextULessThan(kTransferFunctionCount)]; in random_xfer_function()
365 const skcms_Matrix3x3& random_gamut(SkRandom* rand) { in random_gamut() argument
366 return gGamuts[rand->nextULessThan(kGamutCount)]; in random_gamut()
380 ColorSpaceType random_colorspacetype(SkRandom* rand) { in random_colorspacetype() argument
381 return static_cast<ColorSpaceType>(rand->nextULessThan(kColorSpaceTypeCount)); in random_colorspacetype()
384 sk_sp<SkColorSpace> random_colorspace(SkRandom* rand) { in random_colorspace() argument
385 ColorSpaceType cs = random_colorspacetype(rand); in random_colorspace()
395 return SkColorSpace::MakeRGB(random_xfer_function(rand), random_gamut(rand)); in random_colorspace()
407 SkColor random_color(SkRandom* rand, ColorConstraint constraint) { in random_color() argument
408 uint32_t color = rand->nextU(); in random_color()
419 SkColor4f random_color4f(SkRandom* rand, ColorConstraint constraint) { in random_color4f() argument
420 SkColor4f result = { rand->nextRangeF(0.0f, 1.0f), in random_color4f()
421 rand->nextRangeF(0.0f, 1.0f), in random_color4f()
422 rand->nextRangeF(0.0f, 1.0f), in random_color4f()
423 rand->nextRangeF(0.0f, 1.0f) }; in random_color4f()
434 SkTileMode random_tilemode(SkRandom* rand) { in random_tilemode() argument
435 return static_cast<SkTileMode>(rand->nextULessThan(kSkTileModeCount)); in random_tilemode()
438 ShaderType random_shadertype(SkRandom* rand) { in random_shadertype() argument
439 return static_cast<ShaderType>(rand->nextULessThan(kShaderTypeCount)); in random_shadertype()
442 SkBlendMode random_porter_duff_bm(SkRandom* rand) { in random_porter_duff_bm() argument
446 return static_cast<SkBlendMode>(rand->nextRangeU((unsigned int) SkBlendMode::kClear, in random_porter_duff_bm()
450 SkBlendMode random_complex_bm(SkRandom* rand) { in random_complex_bm() argument
451 return static_cast<SkBlendMode>(rand->nextRangeU((unsigned int) SkBlendMode::kPlus, in random_complex_bm()
455 SkBlendMode random_blend_mode(SkRandom* rand) { in random_blend_mode() argument
456 return static_cast<SkBlendMode>(rand->nextULessThan(kSkBlendModeCount)); in random_blend_mode()
459 [[maybe_unused]] MaskFilterType random_maskfiltertype(SkRandom* rand) { in random_maskfiltertype() argument
460 if (rand->nextBool()) { in random_maskfiltertype()
464 return static_cast<MaskFilterType>(rand->nextULessThan(kMaskFilterTypeCount)); in random_maskfiltertype()
467 BlenderType random_blendertype(SkRandom* rand) { in random_blendertype() argument
468 return static_cast<BlenderType>(rand->nextULessThan(kBlenderTypeCount)); in random_blendertype()
471 ColorFilterType random_colorfiltertype(SkRandom* rand) { in random_colorfiltertype() argument
472 return static_cast<ColorFilterType>(rand->nextULessThan(kColorFilterTypeCount)); in random_colorfiltertype()
475 ImageFilterType random_imagefiltertype(SkRandom* rand) { in random_imagefiltertype() argument
476 return static_cast<ImageFilterType>(rand->nextULessThan(kImageFilterTypeCount)); in random_imagefiltertype()
479 [[maybe_unused]] ClipType random_cliptype(SkRandom* rand) { in random_cliptype() argument
480 if (rand->nextBool()) { in random_cliptype()
484 return static_cast<ClipType>(rand->nextULessThan(kClipTypeCount)); in random_cliptype()
487 [[maybe_unused]] DrawTypeFlags random_drawtype(SkRandom* rand) { in random_drawtype() argument
488 uint32_t index = rand->nextULessThan(8); in random_drawtype()
510 SkMatrix* random_local_matrix(SkRandom* rand, in random_local_matrix() argument
514 uint32_t matrix = rand->nextULessThan(constaint == LocalMatrixConstraint::kNone ? 4 : 3); in random_local_matrix()
530 sk_sp<SkImage> make_image(SkRandom* rand, Recorder* recorder) { in make_image() argument
532 if (rand->nextBool()) { in make_image()
536 SkImageInfo info = SkImageInfo::Make(32, 32, ct, kPremul_SkAlphaType, random_colorspace(rand)); in make_image()
548 sk_sp<SkImage> make_yuv_image(SkRandom* rand, Recorder* recorder) { in make_yuv_image() argument
551 if (rand->nextBool()) { in make_yuv_image()
571 if (rand->nextBool()) { in make_yuv_image()
583 sk_sp<SkPicture> make_picture(SkRandom* rand) { in make_picture() argument
598 std::pair<sk_sp<SkShader>, sk_sp<PrecompileShader>> create_coord_clamp_shader(SkRandom* rand, in create_coord_clamp_shader() argument
600 auto [s, o] = create_random_shader(rand, recorder); in create_coord_clamp_shader()
615 std::pair<sk_sp<SkShader>, sk_sp<PrecompileShader>> create_empty_shader(SkRandom* /* rand */) {
623 std::pair<sk_sp<SkShader>, sk_sp<PrecompileShader>> create_perlin_noise_shader(SkRandom* rand) { in create_perlin_noise_shader() argument
627 if (rand->nextBool()) { in create_perlin_noise_shader()
644 std::pair<sk_sp<SkShader>, sk_sp<PrecompileShader>> create_picture_shader(SkRandom* rand) { in create_picture_shader() argument
645 sk_sp<SkPicture> picture = make_picture(rand); in create_picture_shader()
650 SkMatrix* lmPtr = random_local_matrix(rand, &lmStorage); in create_picture_shader()
663 std::pair<sk_sp<SkShader>, sk_sp<PrecompileShader>> create_runtime_shader(SkRandom* /* rand */) { in create_runtime_shader()
686 SkRandom* rand, in create_solid_shader() argument
691 if (rand->nextBool()) { in create_solid_shader()
692 s = SkShaders::Color(random_color(rand, constraint)); in create_solid_shader()
695 sk_sp<SkColorSpace> cs = random_colorspace(rand); in create_solid_shader()
696 s = SkShaders::Color(random_color4f(rand, constraint), cs); in create_solid_shader()
704 SkRandom* rand, in create_gradient_shader() argument
711 random_color(rand, constraint), in create_gradient_shader()
712 random_color(rand, constraint), in create_gradient_shader()
713 random_color(rand, constraint), in create_gradient_shader()
714 random_color(rand, constraint), in create_gradient_shader()
715 random_color(rand, constraint), in create_gradient_shader()
716 random_color(rand, constraint), in create_gradient_shader()
717 random_color(rand, constraint), in create_gradient_shader()
718 random_color(rand, constraint), in create_gradient_shader()
719 random_color(rand, constraint) in create_gradient_shader()
737 switch (rand->nextULessThan(3)) { in create_gradient_shader()
745 SkMatrix* lmPtr = random_local_matrix(rand, &lmStorage); in create_gradient_shader()
747 uint32_t flags = rand->nextBool() ? 0x0 : SkGradientShader::kInterpolateColorsInPremul_Flag; in create_gradient_shader()
752 SkTileMode tm = random_tilemode(rand); in create_gradient_shader()
788 std::pair<sk_sp<SkShader>, sk_sp<PrecompileShader>> create_localmatrix_shader(SkRandom* rand, in create_localmatrix_shader() argument
790 auto [s, o] = create_random_shader(rand, recorder); in create_localmatrix_shader()
797 bool hasPerspective = rand->nextBool(); in create_localmatrix_shader()
800 random_local_matrix(rand, &lmStorage, hasPerspective ? LocalMatrixConstraint::kWithPerspective in create_localmatrix_shader()
806 std::pair<sk_sp<SkShader>, sk_sp<PrecompileShader>> create_colorfilter_shader(SkRandom* rand, in create_colorfilter_shader() argument
808 auto [s, o] = create_random_shader(rand, recorder); in create_colorfilter_shader()
815 auto [cf, cfO] = create_random_colorfilter(rand); in create_colorfilter_shader()
821 std::pair<sk_sp<SkShader>, sk_sp<PrecompileShader>> create_image_shader(SkRandom* rand, in create_image_shader() argument
823 SkTileMode tmX = random_tilemode(rand); in create_image_shader()
824 SkTileMode tmY = random_tilemode(rand); in create_image_shader()
827 SkMatrix* lmPtr = random_local_matrix(rand, &lmStorage); in create_image_shader()
834 if (rand->nextBool()) { in create_image_shader()
835 s = SkShaders::Image(make_image(rand, recorder), in create_image_shader()
841 s = SkShaders::RawImage(make_image(rand, recorder), in create_image_shader()
851 std::pair<sk_sp<SkShader>, sk_sp<PrecompileShader>> create_yuv_image_shader(SkRandom* rand, in create_yuv_image_shader() argument
853 SkTileMode tmX = random_tilemode(rand); in create_yuv_image_shader()
854 SkTileMode tmY = random_tilemode(rand); in create_yuv_image_shader()
857 SkMatrix* lmPtr = random_local_matrix(rand, &lmStorage); in create_yuv_image_shader()
863 if (rand->nextBool()) { in create_yuv_image_shader()
867 sk_sp<SkImage> yuvImage = make_yuv_image(rand, recorder); in create_yuv_image_shader()
868 if (rand->nextBool()) { in create_yuv_image_shader()
880 std::pair<sk_sp<SkShader>, sk_sp<PrecompileShader>> create_blend_shader(SkRandom* rand, in create_blend_shader() argument
884 auto [blender, blenderO] = create_random_blender(rand); in create_blend_shader()
886 auto [dstS, dstO] = create_random_shader(rand, recorder); in create_blend_shader()
892 auto [srcS, srcO] = create_random_shader(rand, recorder); in create_blend_shader()
905 std::pair<sk_sp<SkShader>, sk_sp<PrecompileShader>> create_workingCS_shader(SkRandom* rand, in create_workingCS_shader() argument
907 auto [wrappedS, wrappedO] = create_random_shader(rand, recorder); in create_workingCS_shader()
913 sk_sp<SkColorSpace> cs = random_colorspace(rand); in create_workingCS_shader()
920 std::pair<sk_sp<SkShader>, sk_sp<PrecompileShader>> create_shader(SkRandom* rand, in create_shader() argument
928 return create_blend_shader(rand, recorder); in create_shader()
930 return create_colorfilter_shader(rand, recorder); in create_shader()
932 return create_coord_clamp_shader(rand, recorder); in create_shader()
934 return create_gradient_shader(rand, SkShaderBase::GradientType::kConical); in create_shader()
936 // return create_empty_shader(rand); in create_shader()
938 return create_image_shader(rand, recorder); in create_shader()
940 return create_gradient_shader(rand, SkShaderBase::GradientType::kLinear); in create_shader()
942 return create_localmatrix_shader(rand, recorder); in create_shader()
944 return create_perlin_noise_shader(rand); in create_shader()
946 return create_picture_shader(rand); in create_shader()
948 return create_gradient_shader(rand, SkShaderBase::GradientType::kRadial); in create_shader()
950 return create_runtime_shader(rand); in create_shader()
952 return create_solid_shader(rand); in create_shader()
954 return create_gradient_shader(rand, SkShaderBase::GradientType::kSweep); in create_shader()
956 return create_yuv_image_shader(rand, recorder); in create_shader()
958 return create_workingCS_shader(rand, recorder); in create_shader()
964 std::pair<sk_sp<SkShader>, sk_sp<PrecompileShader>> create_random_shader(SkRandom* rand, in create_random_shader() argument
966 return create_shader(rand, recorder, random_shadertype(rand)); in create_random_shader()
969 std::pair<sk_sp<SkShader>, sk_sp<PrecompileShader>> create_clip_shader(SkRandom* rand, in create_clip_shader() argument
974 switch (rand->nextULessThan(5)) { in create_clip_shader()
975 case 0: return create_gradient_shader(rand, SkShaderBase::GradientType::kConical, in create_clip_shader()
977 case 1: return create_gradient_shader(rand, SkShaderBase::GradientType::kLinear, in create_clip_shader()
979 case 2: return create_gradient_shader(rand, SkShaderBase::GradientType::kRadial, in create_clip_shader()
981 case 3: return create_solid_shader(rand, ColorConstraint::kTransparent); in create_clip_shader()
982 case 4: return create_gradient_shader(rand, SkShaderBase::GradientType::kSweep, in create_clip_shader()
1045 std::pair<sk_sp<SkBlender>, sk_sp<PrecompileBlender>> create_bm_blender(SkRandom* rand, in create_bm_blender() argument
1061 std::pair<sk_sp<SkBlender>, sk_sp<PrecompileBlender>> create_rt_blender(SkRandom* rand) { in create_rt_blender() argument
1062 int option = rand->nextULessThan(3); in create_rt_blender()
1073 std::pair<sk_sp<SkBlender>, sk_sp<PrecompileBlender>> create_blender(SkRandom* rand, in create_blender() argument
1079 return create_bm_blender(rand, random_porter_duff_bm(rand)); in create_blender()
1081 return create_bm_blender(rand, random_complex_bm(rand)); in create_blender()
1085 return create_rt_blender(rand); in create_blender()
1091 std::pair<sk_sp<SkBlender>, sk_sp<PrecompileBlender>> create_random_blender(SkRandom* rand) { in create_random_blender() argument
1092 return create_blender(rand, random_blendertype(rand)); in create_random_blender()
1148 SkRandom* rand) { in create_rt_colorfilter() argument
1149 int option = rand->nextULessThan(3); in create_rt_colorfilter()
1161 SkRandom* rand) { in create_lerp_colorfilter() argument
1163 auto [dst, dstO] = create_random_colorfilter(rand); in create_lerp_colorfilter()
1164 auto [src, srcO] = create_random_colorfilter(rand); in create_lerp_colorfilter()
1168 std::tie(src, srcO) = create_random_colorfilter(rand); in create_lerp_colorfilter()
1189 SkRandom* rand) { in create_blendmode_colorfilter() argument
1197 blend = random_blend_mode(rand); in create_blendmode_colorfilter()
1198 cf = SkColorFilters::Blend(random_color4f(rand, ColorConstraint::kNone), in create_blendmode_colorfilter()
1199 random_colorspace(rand), in create_blendmode_colorfilter()
1217 SkRandom* rand) { in create_color_space_colorfilter() argument
1218 return { SkColorFilterPriv::MakeColorSpaceXform(random_colorspace(rand), in create_color_space_colorfilter()
1219 random_colorspace(rand)), in create_color_space_colorfilter()
1257 SkRandom* rand) { in create_compose_colorfilter() argument
1258 auto [outerCF, outerO] = create_random_colorfilter(rand); in create_compose_colorfilter()
1259 auto [innerCF, innerO] = create_random_colorfilter(rand); in create_compose_colorfilter()
1278 SkRandom* rand) { in create_workingformat_colorfilter() argument
1279 auto [childCF, childO] = create_random_colorfilter(rand); in create_workingformat_colorfilter()
1289 &random_xfer_function(rand), in create_workingformat_colorfilter()
1290 &random_gamut(rand), in create_workingformat_colorfilter()
1308 SkRandom* rand, in create_colorfilter() argument
1315 return create_blendmode_colorfilter(rand); in create_colorfilter()
1317 return create_color_space_colorfilter(rand); in create_colorfilter()
1319 return create_compose_colorfilter(rand); in create_colorfilter()
1327 return create_lerp_colorfilter(rand); in create_colorfilter()
1339 return create_rt_colorfilter(rand); in create_colorfilter()
1345 return create_workingformat_colorfilter(rand); in create_colorfilter()
1352 SkRandom* rand) { in create_random_colorfilter() argument
1353 return create_colorfilter(rand, random_colorfiltertype(rand)); in create_random_colorfilter()
1359 SkRandom* /* rand */) { in arithmetic_imagefilter()
1376 SkRandom* rand) { in blendmode_imagefilter() argument
1378 SkBlendMode bm = random_blend_mode(rand); in blendmode_imagefilter()
1391 SkRandom* rand) { in runtime_blender_imagefilter() argument
1393 auto [blender, blenderO] = create_blender(rand, BlenderType::kRuntime); in runtime_blender_imagefilter()
1405 SkRandom* rand) { in blur_imagefilter() argument
1407 int option = rand->nextULessThan(3); in blur_imagefilter()
1425 SkRandom* rand) { in displacement_imagefilter() argument
1451 SkRandom* rand) { in colorfilter_imagefilter() argument
1453 auto [cf, o] = create_random_colorfilter(rand); in colorfilter_imagefilter()
1457 if (rand->nextBool()) { in colorfilter_imagefilter()
1459 auto [cf2, o2] = create_random_colorfilter(rand); in colorfilter_imagefilter()
1472 SkRandom* rand) { in lighting_imagefilter() argument
1479 int option = rand->nextULessThan(6); in lighting_imagefilter()
1533 SkRandom* rand) { in matrix_convolution_imagefilter() argument
1537 int option = rand->nextULessThan(3); in matrix_convolution_imagefilter()
1565 SkRandom* rand) { in morphology_imagefilter() argument
1570 if (rand->nextBool()) { in morphology_imagefilter()
1583 SkRandom* rand, in create_image_filter() argument
1590 return arithmetic_imagefilter(rand); in create_image_filter()
1592 return blendmode_imagefilter(rand); in create_image_filter()
1594 return runtime_blender_imagefilter(rand); in create_image_filter()
1596 return blur_imagefilter(rand); in create_image_filter()
1598 return colorfilter_imagefilter(rand); in create_image_filter()
1600 return displacement_imagefilter(recorder, rand); in create_image_filter()
1602 return lighting_imagefilter(rand); in create_image_filter()
1604 return matrix_convolution_imagefilter(rand); in create_image_filter()
1606 return morphology_imagefilter(rand); in create_image_filter()
1614 SkRandom* rand) { in create_random_image_filter() argument
1615 return create_image_filter(recorder, rand, random_imagefiltertype(rand)); in create_random_image_filter()
1618 std::pair<sk_sp<SkMaskFilter>, sk_sp<PrecompileMaskFilter>> create_blur_maskfilter(SkRandom* rand) { in create_blur_maskfilter() argument
1620 switch (rand->nextULessThan(4)) { in create_blur_maskfilter()
1629 switch (rand->nextULessThan(2)) { in create_blur_maskfilter()
1636 bool respectCTM = rand->nextBool(); in create_blur_maskfilter()
1641 std::pair<sk_sp<SkMaskFilter>, sk_sp<PrecompileMaskFilter>> create_maskfilter(SkRandom* rand, in create_maskfilter() argument
1645 case MaskFilterType::kBlur: return create_blur_maskfilter(rand); in create_maskfilter()
1652 std::pair<SkPaint, PaintOptions> create_paint(SkRandom* rand, in create_paint() argument
1660 paint.setColor(random_color(rand, ColorConstraint::kOpaque)); in create_paint()
1665 auto [s, o] = create_shader(rand, recorder, shaderType); in create_paint()
1675 auto [cf, o] = create_colorfilter(rand, colorFilterType); in create_paint()
1685 auto [mf, o] = create_maskfilter(rand, maskFilterType); in create_paint()
1695 auto [b, o] = create_blender(rand, blenderType); in create_paint()
1705 auto [filter, o] = create_image_filter(recorder, rand, imageFilterType); in create_paint()
1714 if (rand->nextBool()) { in create_paint()
2000 SkRandom* rand, in extract_vs_build_subtest() argument
2024 Coverage coverage = coverageOptions[rand->nextULessThan(3)]; in extract_vs_build_subtest()
2197 SkRandom rand(seed); in run_test() local
2205 std::tie(clipShader, clipShaderOption) = create_clip_shader(&rand, recorder.get()); in run_test()
2210 auto [paint, paintOptions] = create_paint(&rand, recorder.get(), s, bm, cf, mf, imageFilter); in run_test()
2219 seed, &rand, verbose); in run_test()
2239 SkRandom rand(seed); in DEF_CONDITIONAL_GRAPHITE_TEST_FOR_ALL_CONTEXTS() local
2240 ShaderType shaderType = random_shadertype(&rand); in DEF_CONDITIONAL_GRAPHITE_TEST_FOR_ALL_CONTEXTS()
2241 BlenderType blenderType = random_blendertype(&rand); in DEF_CONDITIONAL_GRAPHITE_TEST_FOR_ALL_CONTEXTS()
2242 ColorFilterType colorFilterType = random_colorfiltertype(&rand); in DEF_CONDITIONAL_GRAPHITE_TEST_FOR_ALL_CONTEXTS()
2243 MaskFilterType maskFilterType = random_maskfiltertype(&rand); in DEF_CONDITIONAL_GRAPHITE_TEST_FOR_ALL_CONTEXTS()
2244 ImageFilterType imageFilterType = ImageFilterType::kNone; // random_imagefiltertype(&rand); in DEF_CONDITIONAL_GRAPHITE_TEST_FOR_ALL_CONTEXTS()
2245 ClipType clipType = random_cliptype(&rand); in DEF_CONDITIONAL_GRAPHITE_TEST_FOR_ALL_CONTEXTS()
2246 DrawTypeFlags drawTypeFlags = random_drawtype(&rand); in DEF_CONDITIONAL_GRAPHITE_TEST_FOR_ALL_CONTEXTS()