Flutter Engine
The Flutter Engine
Functions
skgpu::graphite::PrecompileShaders Namespace Reference

Functions

SK_API sk_sp< PrecompileShaderEmpty ()
 
SK_API sk_sp< PrecompileShaderColor ()
 
SK_API sk_sp< PrecompileShaderColor (sk_sp< SkColorSpace >)
 
SK_API sk_sp< PrecompileShaderBlend (SkSpan< const SkBlendMode > blendModes, SkSpan< const sk_sp< PrecompileShader > > dsts, SkSpan< const sk_sp< PrecompileShader > > srcs)
 
SK_API sk_sp< PrecompileShaderBlend (SkSpan< const sk_sp< PrecompileBlender > > blenders, SkSpan< const sk_sp< PrecompileShader > > dsts, SkSpan< const sk_sp< PrecompileShader > > srcs)
 
SK_API sk_sp< PrecompileShaderCoordClamp (SkSpan< const sk_sp< PrecompileShader > >)
 
SK_API sk_sp< PrecompileShaderImage ()
 
SK_API sk_sp< PrecompileShaderRawImage ()
 
SK_API sk_sp< PrecompileShaderMakeFractalNoise ()
 
SK_API sk_sp< PrecompileShaderMakeTurbulence ()
 
SK_API sk_sp< PrecompileShaderLinearGradient ()
 
SK_API sk_sp< PrecompileShaderRadialGradient ()
 
SK_API sk_sp< PrecompileShaderTwoPointConicalGradient ()
 
SK_API sk_sp< PrecompileShaderSweepGradient ()
 
SK_API sk_sp< PrecompileShaderPicture ()
 
SK_API sk_sp< PrecompileShaderLocalMatrix (SkSpan< const sk_sp< PrecompileShader > > wrapped)
 
SK_API sk_sp< PrecompileShaderColorFilter (SkSpan< const sk_sp< PrecompileShader > > shaders, SkSpan< const sk_sp< PrecompileColorFilter > > colorFilters)
 
SK_API sk_sp< PrecompileShaderWorkingColorSpace (SkSpan< const sk_sp< PrecompileShader > > shaders, SkSpan< const sk_sp< SkColorSpace > > colorSpaces)
 
SK_API sk_sp< PrecompileShaderYUVImage ()
 

Function Documentation

◆ Blend() [1/2]

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::Blend ( SkSpan< const sk_sp< PrecompileBlender > >  blenders,
SkSpan< const sk_sp< PrecompileShader > >  dsts,
SkSpan< const sk_sp< PrecompileShader > >  srcs 
)

Definition at line 230 of file PrecompileShader.cpp.

233 {
234 std::vector<sk_sp<PrecompileBlender>> tmp;
235 tmp.reserve(blenders.size());
236
237 bool needsPorterDuffBased = false;
238 bool needsBlendModeBased = false;
239
240 for (const auto& b : blenders) {
241 if (!b) {
242 needsPorterDuffBased = true; // fall back to kSrcOver
243 } else if (b->priv().asBlendMode().has_value()) {
244 SkBlendMode bm = b->priv().asBlendMode().value();
245
247 if (!coeffs.empty()) {
248 needsPorterDuffBased = true;
249 } else {
250 needsBlendModeBased = true;
251 }
252 } else {
253 tmp.push_back(b);
254 }
255 }
256
257 if (!needsPorterDuffBased && !needsBlendModeBased && tmp.empty()) {
258 needsPorterDuffBased = true; // fallback to kSrcOver
259 }
260
261 return sk_make_sp<PrecompileBlendShader>(SkSpan<const sk_sp<PrecompileBlender>>(tmp),
262 dsts, srcs,
263 needsPorterDuffBased, needsBlendModeBased);
264}
static const char * srcs[2]
Definition: EncodeBench.cpp:88
SkBlendMode
Definition: SkBlendMode.h:38
constexpr size_t size() const
Definition: SkSpan_impl.h:95
static bool b
SkSpan< const float > GetPorterDuffBlendConstants(SkBlendMode mode)
Definition: Blend.cpp:53

◆ Blend() [2/2]

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::Blend ( SkSpan< const SkBlendMode blendModes,
SkSpan< const sk_sp< PrecompileShader > >  dsts,
SkSpan< const sk_sp< PrecompileShader > >  srcs 
)

Definition at line 266 of file PrecompileShader.cpp.

269 {
270
271 bool needsPorterDuffBased = false;
272 bool needsBlendModeBased = false;
273
274 for (SkBlendMode bm : blendModes) {
276 if (!porterDuffConstants.empty()) {
277 needsPorterDuffBased = true;
278 } else {
279 needsBlendModeBased = true;
280 }
281 }
282
283 if (!needsPorterDuffBased && !needsBlendModeBased) {
284 needsPorterDuffBased = true; // fallback to kSrcOver
285 }
286
287 return sk_make_sp<PrecompileBlendShader>(SkSpan<const sk_sp<PrecompileBlender>>(),
288 dsts, srcs,
289 needsPorterDuffBased, needsBlendModeBased);
290}
constexpr bool empty() const
Definition: SkSpan_impl.h:96

◆ Color() [1/2]

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::Color ( )

Definition at line 98 of file PrecompileShader.cpp.

98 {
99 return sk_make_sp<PrecompileColorShader>();
100}

◆ Color() [2/2]

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::Color ( sk_sp< SkColorSpace )

Definition at line 104 of file PrecompileShader.cpp.

104 {
105 return sk_make_sp<PrecompileColorShader>();
106}

◆ ColorFilter()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::ColorFilter ( SkSpan< const sk_sp< PrecompileShader > >  shaders,
SkSpan< const sk_sp< PrecompileColorFilter > >  colorFilters 
)

Definition at line 718 of file PrecompileShader.cpp.

720 {
721 return sk_make_sp<PrecompileColorFilterShader>(std::move(shaders), std::move(colorFilters));
722}

◆ CoordClamp()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::CoordClamp ( SkSpan< const sk_sp< PrecompileShader > >  input)

Definition at line 328 of file PrecompileShader.cpp.

328 {
329 return sk_make_sp<PrecompileCoordClampShader>(input);
330}

◆ Empty()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::Empty ( )

Definition at line 74 of file PrecompileShader.cpp.

74 {
75 return sk_make_sp<PrecompileEmptyShader>();
76}

◆ Image()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::Image ( )

Definition at line 2042 of file raw_object.h.

◆ LinearGradient()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::LinearGradient ( )

Definition at line 523 of file PrecompileShader.cpp.

523 {
525 sk_make_sp<PrecompileGradientShader>(SkShaderBase::GradientType::kLinear);
526 return PrecompileShaders::LocalMatrix({ std::move(s) });
527}
struct MyStruct s
static constexpr skcms_TransferFunction kLinear
Definition: SkColorSpace.h:51
SK_API sk_sp< PrecompileShader > LocalMatrix(SkSpan< const sk_sp< PrecompileShader > > wrapped)

◆ LocalMatrix()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::LocalMatrix ( SkSpan< const sk_sp< PrecompileShader > >  wrapped)

Definition at line 659 of file PrecompileShader.cpp.

660 {
661 return sk_make_sp<PrecompileLocalMatrixShader>(std::move(wrapped));
662}
static sk_sp< GrTextureProxy > wrapped(skiatest::Reporter *reporter, GrRecordingContext *rContext, GrProxyProvider *proxyProvider, SkBackingFit fit)

◆ MakeFractalNoise()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::MakeFractalNoise ( )

Definition at line 466 of file PrecompileShader.cpp.

466 {
467 return sk_make_sp<PrecompilePerlinNoiseShader>();
468}

◆ MakeTurbulence()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::MakeTurbulence ( )

Definition at line 470 of file PrecompileShader.cpp.

470 {
471 return sk_make_sp<PrecompilePerlinNoiseShader>();
472}

◆ Picture()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::Picture ( )

Definition at line 552 of file PrecompileShader.cpp.

552 {
553 // Note: We don't need to consider the PrecompileYUVImageShader since the image
554 // being drawn was created internally by Skia (as non-YUV).
556}
CanvasImage Image
Definition: dart_ui.cc:55
sk_sp< PrecompileShader > LocalMatrixBothVariants(SkSpan< const sk_sp< PrecompileShader > > wrapped)

◆ RadialGradient()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::RadialGradient ( )

Definition at line 529 of file PrecompileShader.cpp.

529 {
531 sk_make_sp<PrecompileGradientShader>(SkShaderBase::GradientType::kRadial);
532 return PrecompileShaders::LocalMatrix({ std::move(s) });
533}

◆ RawImage()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::RawImage ( )

Definition at line 425 of file PrecompileShader.cpp.

425 {
426 // Raw images do not perform color space conversion, but in Graphite, this is represented as
427 // an identity color space xform, not as a distinct shader
429 { sk_make_sp<PrecompileImageShader>(PrecompileImageShaderFlags::kExcludeAlpha) });
430}

◆ SweepGradient()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::SweepGradient ( )

Definition at line 535 of file PrecompileShader.cpp.

535 {
537 sk_make_sp<PrecompileGradientShader>(SkShaderBase::GradientType::kSweep);
538 return PrecompileShaders::LocalMatrix({ std::move(s) });
539}

◆ TwoPointConicalGradient()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::TwoPointConicalGradient ( )

Definition at line 541 of file PrecompileShader.cpp.

541 {
543 sk_make_sp<PrecompileGradientShader>(SkShaderBase::GradientType::kConical);
544 return PrecompileShaders::LocalMatrix({ std::move(s) });
545}

◆ WorkingColorSpace()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::WorkingColorSpace ( SkSpan< const sk_sp< PrecompileShader > >  shaders,
SkSpan< const sk_sp< SkColorSpace > >  colorSpaces 
)

Definition at line 778 of file PrecompileShader.cpp.

780 {
781 return sk_make_sp<PrecompileWorkingColorSpaceShader>(std::move(shaders),
782 std::move(colorSpaces));
783}

◆ YUVImage()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShaders::YUVImage ( )

Definition at line 83 of file FactoryFunctions.cpp.

83 {
84 return sk_make_sp<PrecompileYUVImageShader>();
85}