10#if defined(SK_GRAPHITE)
79bool gNeedSKPPaintOption =
false;
94#define SK_ALL_TEST_SHADERS(M) \
113#define M(type) k##type,
114 SK_ALL_TEST_SHADERS(
M)
117 kLast = kWorkingColorSpace
120static constexpr int kShaderTypeCount =
static_cast<int>(ShaderType::kLast) + 1;
124#define M(type) case ShaderType::k##type : return "ShaderType::k" #type;
125 SK_ALL_TEST_SHADERS(
M)
134#define SK_ALL_TEST_MASKFILTERS(M) \
139#define M(type) k##type,
140 SK_ALL_TEST_MASKFILTERS(
M)
148#define M(type) case MaskFilterType::k##type : return "MaskFilterType::k" #type;
149 SK_ALL_TEST_MASKFILTERS(
M)
158#define SK_ALL_TEST_BLENDERS(M) \
166enum class BlenderType {
167#define M(type) k##type,
168 SK_ALL_TEST_BLENDERS(
M)
174static constexpr int kBlenderTypeCount =
static_cast<int>(BlenderType::kLast) + 1;
176const char*
to_str(BlenderType
b) {
178#define M(type) case BlenderType::k##type : return "BlenderType::k" #type;
179 SK_ALL_TEST_BLENDERS(
M)
190#define SK_ALL_TEST_COLORFILTERS(M) \
209enum class ColorFilterType {
210#define M(type) k##type,
211 SK_ALL_TEST_COLORFILTERS(
M)
214 kLast = kWorkingFormat
217static constexpr int kColorFilterTypeCount =
static_cast<int>(ColorFilterType::kLast) + 1;
219const char*
to_str(ColorFilterType cf) {
221#define M(type) case ColorFilterType::k##type : return "ColorFilterType::k" #type;
222 SK_ALL_TEST_COLORFILTERS(
M)
231#define SK_ALL_TEST_CLIPS(M) \
237#define M(type) k##type,
242const char*
to_str(ClipType c) {
244#define M(type) case ClipType::k##type : return "ClipType::k" #type;
254#define SK_ALL_TEST_IMAGE_FILTERS(M) \
263 M(MatrixConvolution) \
266enum class ImageFilterType {
267#define M(type) k##type,
268 SK_ALL_TEST_IMAGE_FILTERS(
M)
273static constexpr int kImageFilterTypeCount =
static_cast<int>(ImageFilterType::kLast) + 1;
275const char*
to_str(ImageFilterType c) {
277#define M(type) case ImageFilterType::k##type : return "ImageFilterType::k" #type;
278 SK_ALL_TEST_IMAGE_FILTERS(
M)
295static constexpr int kTransferFunctionCount =
std::size(gTransferFunctions);
298 return gTransferFunctions[rand->
nextULessThan(kTransferFunctionCount)];
315enum class ColorSpaceType {
324static constexpr int kColorSpaceTypeCount =
static_cast<int>(ColorSpaceType::kLast) + 1;
326ColorSpaceType random_colorspacetype(
SkRandom* rand) {
327 return static_cast<ColorSpaceType
>(rand->
nextULessThan(kColorSpaceTypeCount));
331 ColorSpaceType cs = random_colorspacetype(rand);
336 case ColorSpaceType::kSRGB:
338 case ColorSpaceType::kSRGBLinear:
340 case ColorSpaceType::kRGB:
347enum class ColorConstraint {
356 switch (constraint) {
358 case ColorConstraint::kOpaque:
return 0xff000000 |
color;
371 switch (constraint) {
373 case ColorConstraint::kOpaque:
result.fA = 1.0f;
return result;
402BlenderType random_blendertype(
SkRandom* rand) {
403 return static_cast<BlenderType
>(rand->
nextULessThan(kBlenderTypeCount));
406ColorFilterType random_colorfiltertype(
SkRandom* rand) {
407 return static_cast<ColorFilterType
>(rand->
nextULessThan(kColorFilterTypeCount));
410ImageFilterType random_imagefiltertype(
SkRandom* rand) {
411 return static_cast<ImageFilterType
>(rand->
nextULessThan(kImageFilterTypeCount));
416 case 0:
return nullptr;
418 case 2: [[fallthrough]];
419 default: storage->
setTranslate(2.0f, 2.0f);
return storage;
461 auto [
s, o] = create_random_shader(rand, recorder);
465 return {
nullptr,
nullptr };
468 constexpr SkRect kSubset{0, 0, 256, 256};
506 gNeedSKPPaintOption =
true;
509 SkMatrix* lmPtr = random_local_matrix(rand, &lmStorage);
526 "uniform float2 center;"
527 "uniform float2 radii;"
528 "half4 main(float2 xy) {"
529 "float len = length(xy - center);"
530 "half value = len < radii.x ? 0.0 : (len > radii.y ? 0.0 : 1.0);"
531 "return half4(value);"
535 static const float kUniforms[4] = { 50.0f, 50.0f, 40.0f, 50.0f };
541 return { std::move(
s), std::move(o) };
565 ColorConstraint constraint = ColorConstraint::kOpaque) {
568 static constexpr int kMaxNumStops = 9;
570 random_color(rand, constraint),
571 random_color(rand, constraint),
572 random_color(rand, constraint),
573 random_color(rand, constraint),
574 random_color(rand, constraint),
575 random_color(rand, constraint),
576 random_color(rand, constraint),
577 random_color(rand, constraint),
578 random_color(rand, constraint)
581 { -100.0f, -100.0f },
591 static const float kOffsets[kMaxNumStops] =
592 { 0.0f, 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.75f, 0.875f, 1.0f };
597 case 0: numStops = 2;
break;
598 case 1: numStops = 7;
break;
599 case 2: [[fallthrough]];
600 default: numStops = kMaxNumStops;
break;
604 SkMatrix* lmPtr = random_local_matrix(rand, &lmStorage);
619 case SkShaderBase::GradientType::kRadial:
624 case SkShaderBase::GradientType::kSweep:
626 colors, kOffsets, numStops, tm,
631 case SkShaderBase::GradientType::kConical:
640 SkDEBUGFAIL(
"Gradient shader says its type is none");
649 auto [
s, o] = create_random_shader(rand, recorder);
653 return {
nullptr,
nullptr };
657 random_local_matrix(rand, &lmStorage);
659 return {
s->makeWithLocalMatrix(lmStorage), o->makeWithLocalMatrix() };
664 auto [
s, o] = create_random_shader(rand, recorder);
668 return {
nullptr,
nullptr };
671 auto [cf, cfO] = create_random_colorfilter(rand);
673 return {
s->makeWithColorFilter(std::move(cf)), o->makeWithColorFilter(std::move(cfO)) };
683 SkMatrix* lmPtr = random_local_matrix(rand, &lmStorage);
711 auto [blender, blenderO] = create_random_blender(rand);
713 auto [dstS, dstO] = create_random_shader(rand, recorder);
716 return {
nullptr,
nullptr };
719 auto [srcS, srcO] = create_random_shader(rand, recorder);
722 return {
nullptr,
nullptr };
734 auto [wrappedS, wrappedO] = create_random_shader(rand, recorder);
737 return {
nullptr,
nullptr };
751 switch (shaderType) {
753 return {
nullptr,
nullptr };
754 case ShaderType::kBlend:
755 return create_blend_shader(rand, recorder);
756 case ShaderType::kColorFilter:
757 return create_colorfilter_shader(rand, recorder);
758 case ShaderType::kCoordClamp:
759 return create_coord_clamp_shader(rand, recorder);
760 case ShaderType::kConicalGradient:
761 return create_gradient_shader(rand, SkShaderBase::GradientType::kConical);
763 return create_empty_shader(rand);
764 case ShaderType::kImage:
765 return create_image_shader(rand, recorder);
766 case ShaderType::kLinearGradient:
768 case ShaderType::kLocalMatrix:
769 return create_localmatrix_shader(rand, recorder);
770 case ShaderType::kPerlinNoise:
771 return create_perlin_noise_shader(rand);
772 case ShaderType::kPicture:
773 return create_picture_shader(rand);
774 case ShaderType::kRadialGradient:
775 return create_gradient_shader(rand, SkShaderBase::GradientType::kRadial);
776 case ShaderType::kRuntime:
777 return create_runtime_shader(rand);
778 case ShaderType::kSolidColor:
779 return create_solid_shader(rand);
780 case ShaderType::kSweepGradient:
781 return create_gradient_shader(rand, SkShaderBase::GradientType::kSweep);
782 case ShaderType::kWorkingColorSpace:
783 return create_workingCS_shader(rand, recorder);
791 return create_shader(rand, recorder, random_shadertype(rand));
800 case 0:
return create_gradient_shader(rand, SkShaderBase::GradientType::kConical,
804 case 2:
return create_gradient_shader(rand, SkShaderBase::GradientType::kRadial,
807 case 4:
return create_gradient_shader(rand, SkShaderBase::GradientType::kSweep,
818 "half4 main(half4 src, half4 dst) {"
825 return { std::move(
b) , std::move(o) };
831 "half4 main(half4 src, half4 dst) {"
838 return { std::move(
b) , std::move(o) };
845 "uniform float blendFrac;"
848 "half4 main(half4 src, half4 dst) {"
849 "return (blendFrac * a.eval(src, dst)) + ((1 - blendFrac) * b.eval(src, dst));"
853 auto [
src, srcO] = src_blender();
854 auto [
dst, dstO] = dest_blender();
859 const float kUniforms[] = { 1.0f };
864 return { std::move(
b) , std::move(o) };
880 return { std::move(
b), std::move(o) };
887 case 0:
return src_blender();
888 case 1:
return dest_blender();
889 case 2:
return combo_blender();
892 return {
nullptr,
nullptr };
899 return {
nullptr,
nullptr };
900 case BlenderType::kPorterDuff:
901 return create_bm_blender(rand, random_porter_duff_bm(rand));
902 case BlenderType::kShaderBased:
903 return create_bm_blender(rand, random_complex_bm(rand));
904 case BlenderType::kArithmetic:
905 return create_arithmetic_blender();
906 case BlenderType::kRuntime:
907 return create_rt_blender(rand);
914 return create_blender(rand, random_blendertype(rand));
922 "half4 main(half4 c) {"
934 "half4 main(half4 c) {"
946 "uniform float blendFrac;"
947 "uniform colorFilter a;"
948 "uniform colorFilter b;"
949 "half4 main(half4 c) {"
950 "return (blendFrac * a.eval(c)) + ((1 - blendFrac) * b.eval(c));"
954 auto [
src, srcO] = double_colorfilter();
955 auto [
dst, dstO] = half_colorfilter();
960 const float kUniforms[] = { 0.5f };
966 return { std::move(cf) , std::move(o) };
974 case 0:
return double_colorfilter();
975 case 1:
return half_colorfilter();
976 case 2:
return combo_colorfilter();
979 return {
nullptr,
nullptr };
985 auto [
dst, dstO] = create_random_colorfilter(rand);
986 auto [
src, srcO] = create_random_colorfilter(rand);
990 std::tie(
src, srcO) = create_random_colorfilter(rand);
1019 random_colorspace(rand),
1020 random_blend_mode(rand));
1025 return { std::move(cf), std::move(o) };
1033 return { std::move(cf), std::move(o) };
1039 random_colorspace(rand)),
1078 auto [outerCF, outerO] = create_random_colorfilter(rand);
1079 auto [innerCF, innerO] = create_random_colorfilter(rand);
1092 static constexpr uint8_t
kTable[256] = { 0 };
1099 auto [childCF, childO] = create_random_colorfilter(rand);
1102 return {
nullptr,
nullptr };
1109 &random_xfer_function(rand),
1110 &random_gamut(rand),
1114 { std::move(childO) });
1116 return { std::move(cf), std::move(o) };
1124 return { std::move(cf), std::move(o) };
1129 ColorFilterType
type) {
1133 return {
nullptr,
nullptr };
1134 case ColorFilterType::kBlendMode:
1135 return create_blendmode_colorfilter(rand);
1136 case ColorFilterType::kColorSpaceXform:
1137 return create_color_space_colorfilter(rand);
1138 case ColorFilterType::kCompose:
1139 return create_compose_colorfilter(rand);
1140 case ColorFilterType::kGaussian:
1141 return create_gaussian_colorfilter();
1143 return create_high_contrast_colorfilter();
1144 case ColorFilterType::kHSLAMatrix:
1145 return create_hsla_matrix_colorfilter();
1146 case ColorFilterType::kLerp:
1147 return create_lerp_colorfilter(rand);
1148 case ColorFilterType::kLighting:
1149 return create_lighting_colorfilter();
1150 case ColorFilterType::kLinearToSRGB:
1151 return create_linear_to_srgb_colorfilter();
1152 case ColorFilterType::kLuma:
1153 return create_luma_colorfilter();
1154 case ColorFilterType::kMatrix:
1155 return create_matrix_colorfilter();
1156 case ColorFilterType::kOverdraw:
1157 return create_overdraw_colorfilter();
1158 case ColorFilterType::kRuntime:
1159 return create_rt_colorfilter(rand);
1160 case ColorFilterType::kSRGBToLinear:
1161 return create_srgb_to_linear_colorfilter();
1162 case ColorFilterType::kTable:
1163 return create_table_colorfilter();
1164 case ColorFilterType::kWorkingFormat:
1165 return create_workingformat_colorfilter(rand);
1173 return create_colorfilter(rand, random_colorfiltertype(rand));
1192 return { std::move(arithmeticIF), std::move(option) };
1207 return { std::move(blendIF), std::move(blendO) };
1213 auto [blender, blenderO] = create_blender(rand, BlenderType::kRuntime);
1221 return { std::move(blenderIF), std::move(option) };
1231 case 0: sigma = 1.0f;
break;
1232 case 1: sigma = 2.0f;
break;
1233 case 2: [[fallthrough]];
1234 default: sigma = 5.0f;
break;
1240 return { std::move(blurIF), std::move(blurO) };
1267 return { std::move(displacementIF), std::move(option) };
1273 auto [cf, o] = create_random_colorfilter(rand);
1279 auto [cf2, o2] = create_random_colorfilter(rand);
1288 return { std::move(cfIF), std::move(cfIFO) };
1294 static constexpr SkPoint3 kTarget{0, 0, 0};
1295 static constexpr SkPoint3 kDirection{0, 1, 0};
1349 return { std::move(lightingIF), std::move(lightingO) };
1359 case 0: kernelSize = 3;
break;
1360 case 1: kernelSize = 7;
break;
1361 case 2: kernelSize = 11;
break;
1364 int center = (kernelSize * kernelSize - 1) / 2;
1365 std::vector<float> kernel(kernelSize * kernelSize,
SkIntToScalar(1));
1366 kernel[
center] = 2.0f - kernelSize * kernelSize;
1381 return { std::move(matrixConvIF), std::move(convOption) };
1386 static constexpr float kRadX = 2.0f, kRadY = 4.0f;
1398 return { std::move(morphologyIF), std::move(option) };
1404 ImageFilterType
type) {
1409 case ImageFilterType::kArithmetic:
1410 return arithmetic_imagefilter(rand);
1411 case ImageFilterType::kBlendMode:
1412 return blendmode_imagefilter(rand);
1413 case ImageFilterType::kRuntimeBlender:
1414 return runtime_blender_imagefilter(rand);
1416 return blur_imagefilter(rand);
1417 case ImageFilterType::kColorFilter:
1418 return colorfilter_imagefilter(rand);
1419 case ImageFilterType::kDisplacement:
1420 return displacement_imagefilter(recorder, rand);
1421 case ImageFilterType::kLighting:
1422 return lighting_imagefilter(rand);
1423 case ImageFilterType::kMatrixConvolution:
1424 return matrix_convolution_imagefilter(rand);
1425 case ImageFilterType::kMorphology:
1426 return morphology_imagefilter(rand);
1435 return create_image_filter(recorder, rand, random_imagefiltertype(rand));
1444 case 3: [[fallthrough]];
1450 case 0: sigma = 1.0f;
break;
1451 case 1: sigma = 2.0f;
break;
1452 case 2: [[fallthrough]];
1453 default: sigma = 5.0f;
break;
1456 bool respectCTM = rand->
nextBool();
1472std::pair<SkPaint, PaintOptions> create_paint(
SkRandom* rand,
1475 BlenderType blenderType,
1476 ColorFilterType colorFilterType,
1478 ImageFilterType imageFilterType) {
1480 paint.setColor(random_color(rand, ColorConstraint::kOpaque));
1485 auto [
s, o] = create_shader(rand, recorder, shaderType);
1489 paint.setShader(std::move(
s));
1495 auto [cf, o] = create_colorfilter(rand, colorFilterType);
1499 paint.setColorFilter(std::move(cf));
1505 auto [mf, o] = create_maskfilter(rand, maskFilterType);
1509 paint.setMaskFilter(std::move(mf));
1515 auto [
b, o] = create_blender(rand, blenderType);
1519 paint.setBlender(std::move(
b));
1525 auto [filter, o] = create_image_filter(recorder, rand, imageFilterType);
1529 paint.setImageFilter(std::move(filter));
1535 paint.setDither(
true);
1539 return {
paint, paintOptions };
1548 path.lineTo(16, 16);
1553 return path.detach();
1569 if (!
paint.getShader() &&
1570 !
paint.getColorFilter() &&
1571 !
paint.getImageFilter() &&
1572 paint.asBlendMode().has_value()) {
1579 paint.asBlendMode().value());
1595 const DrawData& drawData) {
1597 int before = context->priv().globalCache()->numGraphicsPipelines();
1600 std::vector<skgpu::UniqueKey> beforeKeys;
1617 case ClipType::kShader:
1621 case ClipType::kShader_Diff:
1629 simple_draws(canvas,
paint);
1632 non_simple_draws(canvas,
paint, drawData);
1635 simple_draws(canvas,
paint);
1636 non_simple_draws(canvas,
paint, drawData);
1650 std::unique_ptr<skgpu::graphite::Recording> recording = recorder->
snap();
1651 context->insertRecording({ recording.get() });
1655 int after = context->priv().globalCache()->numGraphicsPipelines();
1661 if (before != after) {
1662 const RendererProvider* rendererProvider = context->priv().rendererProvider();
1665 std::vector<skgpu::UniqueKey> afterKeys;
1670 if (
std::find(beforeKeys.begin(), beforeKeys.end(), afterKey) == beforeKeys.end()) {
1674 &originalPipelineDesc,
1675 &originalRenderPassDesc);
1677 SkDebugf(
"------- New key from draw:\n");
1678 afterKey.dump(
"original key:");
1679 UniqueKeyUtils::DumpDescs(rendererProvider, dict,
1680 originalPipelineDesc,
1681 originalRenderPassDesc);
1720 std::unique_ptr<RuntimeEffectDictionary> rtDict = std::make_unique<RuntimeEffectDictionary>();
1722 auto dstTexInfo = context->priv().caps()->getDefaultSampledTextureInfo(
1730 context->priv().resourceProvider(),
1733 "PaintParamsKeyTestFakeDstTexture",
1737 KeyContext precompileKeyContext(context->priv().caps(),
1745 const char text[] =
"hambur";
1747 constexpr int kNumVerts = 4;
1748 constexpr SkPoint kPositions[kNumVerts] { {0,0}, {0,16}, {16,16}, {16,0} };
1752 DrawData drawData = {
1756 kPositions, kPositions,
kColors),
1758 kPositions, kPositions,
nullptr),
1764 ShaderType::kRadialGradient,
1765 ShaderType::kSolidColor,
1768 ShaderType::kColorFilter,
1769 ShaderType::kCoordClamp,
1770 ShaderType::kConicalGradient,
1772 ShaderType::kLinearGradient,
1773 ShaderType::kLocalMatrix,
1774 ShaderType::kPerlinNoise,
1775 ShaderType::kPicture,
1776 ShaderType::kRuntime,
1777 ShaderType::kSweepGradient,
1778 ShaderType::kWorkingColorSpace,
1782 BlenderType blenders[] = {
1783 BlenderType::kPorterDuff,
1784 BlenderType::kShaderBased,
1785 BlenderType::kRuntime,
1788 BlenderType::kArithmetic,
1792 ColorFilterType colorFilters[] = {
1794 ColorFilterType::kBlendMode,
1795 ColorFilterType::kMatrix,
1797 ColorFilterType::kColorSpaceXform,
1798 ColorFilterType::kCompose,
1799 ColorFilterType::kGaussian,
1801 ColorFilterType::kHSLAMatrix,
1802 ColorFilterType::kLerp,
1803 ColorFilterType::kLighting,
1804 ColorFilterType::kLinearToSRGB,
1805 ColorFilterType::kLuma,
1806 ColorFilterType::kOverdraw,
1807 ColorFilterType::kRuntime,
1808 ColorFilterType::kSRGBToLinear,
1809 ColorFilterType::kTable,
1810 ColorFilterType::kWorkingFormat,
1821 ImageFilterType imageFilters[] = {
1824 ImageFilterType::kArithmetic,
1825 ImageFilterType::kBlendMode,
1826 ImageFilterType::kRuntimeBlender,
1828 ImageFilterType::kColorFilter,
1829 ImageFilterType::kDisplacement,
1830 ImageFilterType::kLighting,
1831 ImageFilterType::kMatrixConvolution,
1832 ImageFilterType::kMorphology,
1836 ClipType clips[] = {
1840 ClipType::kShader_Diff,
1850 for (
auto shader : shaders) {
1851 for (
auto blender : blenders) {
1852 for (
auto cf : colorFilters) {
1853 for (
auto mf : maskFilters) {
1854 for (
auto imageFilter : imageFilters) {
1855 for (
auto clip : clips) {
1857 SkDebugf(
"%d/%zu\n", current, kExpected);
1862 drawData, shader, blender, cf, mf, imageFilter,
clip);
1871 SkASSERT(current == (
int) kExpected);
1879 const DrawData& drawData,
1884 ImageFilterType imageFilter,
1888 std::unique_ptr<Recorder> recorder = context->makeRecorder();
1895 if (
clip == ClipType::kShader ||
clip == ClipType::kShader_Diff) {
1896 std::tie(clipShader, clipShaderOption) = create_clip_shader(&rand, recorder.get());
1897 SkASSERT(!clipShader == !clipShaderOption);
1904 gNeedSKPPaintOption =
false;
1905 auto [
paint, paintOptions] = create_paint(&rand, recorder.get(),
s, bm, cf, mf, imageFilter);
1917 for (
bool withPrimitiveBlender : {
false,
true }) {
1920 if (withPrimitiveBlender) {
1929 constexpr Coverage coverageOptions[3] = {
1940 bool needsDstSample = dstReadReq == DstReadRequirement::kTextureCopy ||
1941 dstReadReq == DstReadRequirement::kTextureSample;
1950 if (
clip == ClipType::kShader_Diff && modifiedClipShader) {
1956 auto [paintID, uData, tData] =
1964 std::move(modifiedClipShader),
1974 std::vector<UniquePaintParamsID> precompileIDs;
1976 &precompileGatherer,
1978 withPrimitiveBlender,
1984 precompileIDs.push_back(
id);
1996 auto result =
std::find(precompileIDs.begin(), precompileIDs.end(), paintID);
1998 if (
result == precompileIDs.end()) {
1999 SkDebugf(
"Failure on case: %s %s %s %s %s %s\n",
2005 if (
result == precompileIDs.end()) {
2007 dict->dump(paintID);
2009 SkDebugf(
"From combination builder [%d]:",
static_cast<int>(precompileIDs.size()));
2010 for (
auto iter : precompileIDs) {
2019 context->priv().globalCache()->resetGraphicsPipelines();
2021 int before = context->priv().globalCache()->numGraphicsPipelines();
2023 if (gNeedSKPPaintOption) {
2028 int after = context->priv().globalCache()->numGraphicsPipelines();
static void run_test(GrDirectContext *dContext, skiatest::Reporter *reporter, BulkRectTest test)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
DEF_CONDITIONAL_GRAPHITE_TEST_FOR_ALL_CONTEXTS(ImageWrapTextureMipmapsTest, reporter, context, testContext, true, CtsEnforcement::kNextRelease)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
#define SkDEBUGFAIL(message)
static constexpr int kSkBlendModeCount
@ kLastCoeffMode
last porter duff blend mode
@ kSrcOver
r = s + (1-sa)*d
@ kLastMode
last valid value
SkBlenderBase * as_BB(SkBlender *blend)
@ kOuter_SkBlurStyle
nothing inside, fuzzy outside
@ kSolid_SkBlurStyle
solid inside, fuzzy outside
@ kInner_SkBlurStyle
fuzzy inside, nothing outside
@ kNormal_SkBlurStyle
fuzzy inside and outside
@ kAlpha_8_SkColorType
pixel with alpha in 8-bit byte
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
constexpr SkColor SK_ColorYELLOW
constexpr SkColor SK_ColorMAGENTA
constexpr SkColor SK_ColorCYAN
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorBLACK
constexpr SkColor SK_ColorGREEN
constexpr SkColor SK_ColorWHITE
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
@ kJPEG_Full_SkYUVColorSpace
describes full range
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
sk_sp< T > sk_ref_sp(T *obj)
SkRuntimeEffect * SkMakeRuntimeEffect(SkRuntimeEffect::Result(*make)(SkString, const SkRuntimeEffect::Options &), const char *sksl, SkRuntimeEffect::Options options=SkRuntimeEffect::Options{})
SkShaderBase * as_SB(SkShader *shader)
static constexpr int kSkTileModeCount
static constexpr bool SkToBool(const T &x)
#define REPORTER_ASSERT(r, cond,...)
static SkScalar center(float pos0, float pos1)
int find(T *array, int N, T item)
static sk_sp< SkImage > make_image(SkCanvas *destCanvas)
virtual std::optional< SkBlendMode > asBlendMode() const
static sk_sp< SkBlender > Mode(SkBlendMode mode)
static sk_sp< SkBlender > Arithmetic(float k1, float k2, float k3, float k4, bool enforcePremul)
void drawRect(const SkRect &rect, const SkPaint &paint)
void experimental_DrawEdgeAAQuad(const SkRect &rect, const SkPoint clip[4], QuadAAFlags aaFlags, const SkColor4f &color, SkBlendMode mode)
void drawRRect(const SkRRect &rrect, const SkPaint &paint)
void drawPath(const SkPath &path, const SkPaint &paint)
void clipShader(sk_sp< SkShader >, SkClipOp=SkClipOp::kIntersect)
void drawVertices(const SkVertices *vertices, SkBlendMode mode, const SkPaint &paint)
void drawTextBlob(const SkTextBlob *blob, SkScalar x, SkScalar y, const SkPaint &paint)
static sk_sp< SkColorFilter > WithWorkingFormat(sk_sp< SkColorFilter > child, const skcms_TransferFunction *tf, const skcms_Matrix3x3 *gamut, const SkAlphaType *at)
static sk_sp< SkColorFilter > MakeColorSpaceXform(sk_sp< SkColorSpace > src, sk_sp< SkColorSpace > dst)
static sk_sp< SkColorFilter > MakeGaussian()
static sk_sp< SkColorFilter > Compose(const sk_sp< SkColorFilter > &outer, sk_sp< SkColorFilter > inner)
static sk_sp< SkColorFilter > Blend(const SkColor4f &c, sk_sp< SkColorSpace >, SkBlendMode mode)
static sk_sp< SkColorFilter > Table(const uint8_t table[256])
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
static sk_sp< SkColorFilter > HSLAMatrix(const SkColorMatrix &)
static sk_sp< SkColorFilter > Lighting(SkColor mul, SkColor add)
static sk_sp< SkColorFilter > SRGBToLinearGamma()
static sk_sp< SkColorFilter > Lerp(float t, sk_sp< SkColorFilter > dst, sk_sp< SkColorFilter > src)
static sk_sp< SkColorFilter > LinearToSRGBGamma()
static SkColorMatrix RGBtoYUV(SkYUVColorSpace)
static sk_sp< SkColorSpace > MakeSRGB()
static sk_sp< SkColorSpace > MakeRGB(const skcms_TransferFunction &transferFn, const skcms_Matrix3x3 &toXYZ)
static sk_sp< SkColorSpace > MakeSRGBLinear()
static sk_sp< SkData > MakeWithCopy(const void *data, size_t length)
static sk_sp< SkShader > MakeTwoPointConical(const SkPoint &start, SkScalar startRadius, const SkPoint &end, SkScalar endRadius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
static sk_sp< SkShader > MakeSweep(SkScalar cx, SkScalar cy, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, SkScalar startAngle, SkScalar endAngle, uint32_t flags, const SkMatrix *localMatrix)
static sk_sp< SkShader > MakeRadial(const SkPoint ¢er, SkScalar radius, const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
@ kInterpolateColorsInPremul_Flag
static sk_sp< SkImageFilter > PointLitDiffuse(const SkPoint3 &location, SkColor lightColor, SkScalar surfaceScale, SkScalar kd, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > MatrixConvolution(const SkISize &kernelSize, const SkScalar kernel[], SkScalar gain, SkScalar bias, const SkIPoint &kernelOffset, SkTileMode tileMode, bool convolveAlpha, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > ColorFilter(sk_sp< SkColorFilter > cf, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Erode(SkScalar radiusX, SkScalar radiusY, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > DistantLitSpecular(const SkPoint3 &direction, SkColor lightColor, SkScalar surfaceScale, SkScalar ks, SkScalar shininess, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > DistantLitDiffuse(const SkPoint3 &direction, SkColor lightColor, SkScalar surfaceScale, SkScalar kd, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Arithmetic(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4, bool enforcePMColor, sk_sp< SkImageFilter > background, sk_sp< SkImageFilter > foreground, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > DisplacementMap(SkColorChannel xChannelSelector, SkColorChannel yChannelSelector, SkScalar scale, sk_sp< SkImageFilter > displacement, sk_sp< SkImageFilter > color, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Image(sk_sp< SkImage > image, const SkRect &srcRect, const SkRect &dstRect, const SkSamplingOptions &sampling)
static sk_sp< SkImageFilter > Blend(SkBlendMode mode, sk_sp< SkImageFilter > background, sk_sp< SkImageFilter > foreground=nullptr, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Dilate(SkScalar radiusX, SkScalar radiusY, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > PointLitSpecular(const SkPoint3 &location, SkColor lightColor, SkScalar surfaceScale, SkScalar ks, SkScalar shininess, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > SpotLitDiffuse(const SkPoint3 &location, const SkPoint3 &target, SkScalar falloffExponent, SkScalar cutoffAngle, SkColor lightColor, SkScalar surfaceScale, SkScalar kd, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > SpotLitSpecular(const SkPoint3 &location, const SkPoint3 &target, SkScalar falloffExponent, SkScalar cutoffAngle, SkColor lightColor, SkScalar surfaceScale, SkScalar ks, SkScalar shininess, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
SkMatrix & setTranslate(SkScalar dx, SkScalar dy)
static const SkMatrix & I()
static sk_sp< SkColorFilter > MakeWithSkColors(const SkColor[kNumColors])
static constexpr int kNumColors
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
sk_sp< SkPicture > finishRecordingAsPicture()
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, SkFilterMode mode, const SkMatrix *localMatrix, const SkRect *tileRect) const
static SkRRect MakeOval(const SkRect &oval)
static SkRRect MakeRectXY(const SkRect &rect, SkScalar xRad, SkScalar yRad)
uint32_t nextULessThan(uint32_t count)
float nextRangeF(float min, float max)
uint32_t nextRangeU(uint32_t min, uint32_t max)
sk_sp< SkShader > makeShader(sk_sp< const SkData > uniforms, sk_sp< SkShader > children[], size_t childCount, const SkMatrix *localMatrix=nullptr) const
static Result MakeForColorFilter(SkString sksl, const Options &)
sk_sp< SkBlender > makeBlender(sk_sp< const SkData > uniforms, SkSpan< const ChildPtr > children={}) const
static Result MakeForBlender(SkString sksl, const Options &)
static Result MakeForShader(SkString sksl, const Options &)
sk_sp< SkColorFilter > makeColorFilter(sk_sp< const SkData > uniforms) const
sk_sp< SkShader > makeWithCTM(const SkMatrix &) const
sk_sp< SkShader > makeWithColorFilter(sk_sp< SkColorFilter >) const
static sk_sp< SkTextBlob > MakeFromText(const void *text, size_t byteLength, const SkFont &font, SkTextEncoding encoding=SkTextEncoding::kUTF8)
static sk_sp< SkVertices > MakeCopy(VertexMode mode, int vertexCount, const SkPoint positions[], const SkPoint texs[], const SkColor colors[], int indexCount, const uint16_t indices[])
@ kTriangleFan_VertexMode
SkIPoint dstOffset() const
sk_sp< TextureProxy > dstTexture() const
const SkColorInfo & dstColorInfo() const
void setClipShaders(SkSpan< const sk_sp< PrecompileShader > > clipShaders)
void buildCombinations(const KeyContext &keyContext, PipelineDataGatherer *gatherer, DrawTypeFlags drawTypes, bool withPrimitiveBlender, Coverage coverage, const ProcessCombination &processCombination) const
void setColorFilters(SkSpan< const sk_sp< PrecompileColorFilter > > colorFilters)
void setDither(bool dither)
void setShaders(SkSpan< const sk_sp< PrecompileShader > > shaders)
void setMaskFilters(SkSpan< const sk_sp< PrecompileMaskFilter > > maskFilters)
void setImageFilters(SkSpan< const sk_sp< PrecompileImageFilter > > imageFilters)
void setBlenders(SkSpan< const sk_sp< PrecompileBlender > > blenders)
std::unique_ptr< Recording > snap()
void syncedSubmit(skgpu::graphite::Context *)
static const skcms_Matrix3x3 gGamuts[]
FlutterSemanticsFlag flags
static const FlSetting kHighContrast
constexpr SkColor4f kTransparent
SK_API sk_sp< SkImage > TextureFromImage(GrDirectContext *, const SkImage *, skgpu::Mipmapped=skgpu::Mipmapped::kNo, skgpu::Budgeted=skgpu::Budgeted::kYes)
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
static constexpr skcms_Matrix3x3 kSRGB
static constexpr skcms_Matrix3x3 kAdobeRGB
static constexpr skcms_Matrix3x3 kXYZ
static constexpr skcms_Matrix3x3 kRec2020
static constexpr skcms_Matrix3x3 kDisplayP3
static constexpr skcms_TransferFunction kRec2020
static constexpr skcms_TransferFunction k2Dot2
static constexpr skcms_TransferFunction kSRGB
static constexpr skcms_TransferFunction kHLG
static constexpr skcms_TransferFunction kPQ
static constexpr skcms_TransferFunction kLinear
sk_sp< const SkPicture > picture
PODArray< SkColor > colors
SK_API sk_sp< SkShader > Blend(SkBlendMode mode, sk_sp< SkShader > dst, sk_sp< SkShader > src)
SK_API sk_sp< SkShader > Color(SkColor)
SK_API sk_sp< SkShader > MakeTurbulence(SkScalar baseFrequencyX, SkScalar baseFrequencyY, int numOctaves, SkScalar seed, const SkISize *tileSize=nullptr)
SK_API sk_sp< SkShader > CoordClamp(sk_sp< SkShader >, const SkRect &subset)
SK_API sk_sp< SkShader > RawImage(sk_sp< SkImage > image, SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &options, const SkMatrix *localMatrix=nullptr)
SK_API sk_sp< SkShader > Image(sk_sp< SkImage > image, SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &options, const SkMatrix *localMatrix=nullptr)
SK_API sk_sp< SkShader > MakeFractalNoise(SkScalar baseFrequencyX, SkScalar baseFrequencyY, int numOctaves, SkScalar seed, const SkISize *tileSize=nullptr)
SK_API sk_sp< SkShader > Empty()
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
void FetchUniqueKeys(GlobalCache *globalCache, std::vector< UniqueKey > *keys)
bool ExtractKeyDescs(Context *context, const UniqueKey &origKey, GraphicsPipelineDesc *pipelineDesc, RenderPassDesc *renderPassDesc)
constexpr std::array< std::array< float, 2 >, 2 > kRect
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
font
Font Metadata and Metrics.
SK_API sk_sp< PrecompileBlender > Arithmetic()
sk_sp< PrecompileColorFilter > WithWorkingFormat(SkSpan< const sk_sp< PrecompileColorFilter > > childOptions)
sk_sp< PrecompileColorFilter > Gaussian()
sk_sp< PrecompileColorFilter > ColorSpaceXform()
SK_API sk_sp< PrecompileColorFilter > HSLAMatrix()
SK_API sk_sp< PrecompileColorFilter > Matrix()
SK_API sk_sp< PrecompileColorFilter > Overdraw()
SK_API sk_sp< PrecompileColorFilter > Lighting()
SK_API sk_sp< PrecompileColorFilter > Luma()
SK_API sk_sp< PrecompileColorFilter > Compose(SkSpan< const sk_sp< PrecompileColorFilter > > outer, SkSpan< const sk_sp< PrecompileColorFilter > > inner)
SK_API sk_sp< PrecompileColorFilter > HighContrast()
SK_API sk_sp< PrecompileColorFilter > SRGBToLinearGamma()
SK_API sk_sp< PrecompileColorFilter > LinearToSRGBGamma()
SK_API sk_sp< PrecompileColorFilter > Table()
SK_API sk_sp< PrecompileColorFilter > Lerp(SkSpan< const sk_sp< PrecompileColorFilter > > dstOptions, SkSpan< const sk_sp< PrecompileColorFilter > > srcOptions)
SK_API sk_sp< PrecompileImageFilter > Blur(sk_sp< PrecompileImageFilter > input)
SK_API sk_sp< PrecompileImageFilter > MatrixConvolution(sk_sp< PrecompileImageFilter > input)
SK_API sk_sp< PrecompileImageFilter > DisplacementMap(sk_sp< PrecompileImageFilter > input)
SK_API sk_sp< PrecompileImageFilter > Morphology(sk_sp< PrecompileImageFilter > input)
SK_API sk_sp< PrecompileShader > ColorFilter(SkSpan< const sk_sp< PrecompileShader > > shaders, SkSpan< const sk_sp< PrecompileColorFilter > > colorFilters)
SK_API sk_sp< PrecompileShader > LinearGradient()
SK_API sk_sp< PrecompileShader > RadialGradient()
SK_API sk_sp< PrecompileShader > Picture()
SK_API sk_sp< PrecompileShader > SweepGradient()
SK_API sk_sp< PrecompileShader > TwoPointConicalGradient()
static std::string to_str(const SharedContext *ctx, const GraphicsPipelineDesc &gpDesc, const RenderPassDesc &rpDesc)
sk_sp< PrecompileBlender > MakePrecompileBlender(sk_sp< SkRuntimeEffect > effect, SkSpan< const PrecompileChildOptions > childOptions)
sk_sp< PrecompileShader > MakePrecompileShader(sk_sp< SkRuntimeEffect > effect, SkSpan< const PrecompileChildOptions > childOptions)
DstReadRequirement GetDstReadRequirement(const Caps *caps, std::optional< SkBlendMode > blendMode, Coverage coverage)
void Precompile(Context *context, const PaintOptions &paintOptions, DrawTypeFlags drawTypes=kMostCommon)
sk_sp< PrecompileColorFilter > MakePrecompileColorFilter(sk_sp< SkRuntimeEffect > effect, SkSpan< const PrecompileChildOptions > childOptions)
std::tuple< UniquePaintParamsID, const UniformDataBlock *, const TextureDataBlock * > ExtractPaintData(Recorder *recorder, PipelineDataGatherer *gatherer, PaintParamsKeyBuilder *builder, const Layout layout, const SkM44 &local2Dev, const PaintParams &p, const Geometry &geometry, sk_sp< TextureProxy > dstTexture, SkIPoint dstOffset, const SkColorInfo &targetColorInfo)
static constexpr SkPoint kPts[kPtsCount]
SkSamplingOptions(SkFilterMode::kLinear))
static SkPath make_path()
static sk_sp< SkColorFilter > Make(const SkHighContrastConfig &config)
static constexpr SkIPoint Make(int32_t x, int32_t y)
static constexpr SkISize Make(int32_t w, int32_t h)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static sk_sp< SkColorFilter > Make()
static constexpr SkRect MakeWH(float w, float h)
static sk_sp< SkImage > make_picture(const SkImageInfo &info, GrRecordingContext *, void(*draw)(SkCanvas *))
static void checkerboard(SkCanvas *canvas, SkColor c1, SkColor c2, int size)