Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | Friends | List of all members
skgpu::graphite::PrecompileShader Class Reference

#include <PrecompileShader.h>

Inheritance diagram for skgpu::graphite::PrecompileShader:
skgpu::graphite::PrecompileBase SkRefCnt SkRefCntBase skgpu::graphite::PrecompileBlendShader skgpu::graphite::PrecompileBlurShader skgpu::graphite::PrecompileCTMShader skgpu::graphite::PrecompileColorFilterShader skgpu::graphite::PrecompileColorShader skgpu::graphite::PrecompileCoordClampShader skgpu::graphite::PrecompileDisplacementShader skgpu::graphite::PrecompileEmptyShader skgpu::graphite::PrecompileGradientShader skgpu::graphite::PrecompileImageShader skgpu::graphite::PrecompileLightingShader skgpu::graphite::PrecompileLocalMatrixShader skgpu::graphite::PrecompileMatrixConvolutionShader skgpu::graphite::PrecompileMorphologyShader skgpu::graphite::PrecompilePerlinNoiseShader skgpu::graphite::PrecompileWorkingColorSpaceShader skgpu::graphite::PrecompileYUVImageShader

Public Member Functions

sk_sp< PrecompileShadermakeWithLocalMatrix ()
 
sk_sp< PrecompileShadermakeWithColorFilter (sk_sp< PrecompileColorFilter >)
 
sk_sp< PrecompileShadermakeWithWorkingColorSpace (sk_sp< SkColorSpace >)
 
PrecompileShaderPriv priv ()
 
const PrecompileShaderPriv priv () const
 
- Public Member Functions inherited from skgpu::graphite::PrecompileBase
Type type () const
 
PrecompileBasePriv priv ()
 
const PrecompileBasePriv priv () const
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Protected Member Functions

 PrecompileShader ()
 
 ~PrecompileShader () override
 
virtual bool isConstant (int) const
 
virtual bool isALocalMatrixShader () const
 
- Protected Member Functions inherited from skgpu::graphite::PrecompileBase
 PrecompileBase (Type type)
 
virtual int numIntrinsicCombinations () const
 
virtual int numChildCombinations () const
 
int numCombinations () const
 
virtual void addToKey (const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, int desiredCombination) const =0
 

Friends

class PrecompileShaderPriv
 

Additional Inherited Members

- Public Types inherited from skgpu::graphite::PrecompileBase
enum class  Type {
  kBlender , kColorFilter , kImageFilter , kMaskFilter ,
  kShader
}
 
- Static Protected Member Functions inherited from skgpu::graphite::PrecompileBase
template<typename T >
static std::pair< sk_sp< T >, intSelectOption (SkSpan< const sk_sp< T > > options, int desiredOption)
 
template<typename T >
static void AddToKey (const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, SkSpan< const sk_sp< T > > options, int desiredOption)
 

Detailed Description

This class corresponds to the SkShader class in the main API.

Definition at line 26 of file PrecompileShader.h.

Constructor & Destructor Documentation

◆ PrecompileShader()

skgpu::graphite::PrecompileShader::PrecompileShader ( )
inlineprotected

◆ ~PrecompileShader()

skgpu::graphite::PrecompileShader::~PrecompileShader ( )
overrideprotecteddefault

Member Function Documentation

◆ isALocalMatrixShader()

virtual bool skgpu::graphite::PrecompileShader::isALocalMatrixShader ( ) const
inlineprotectedvirtual

Definition at line 86 of file PrecompileShader.h.

86{ return false; }

◆ isConstant()

virtual bool skgpu::graphite::PrecompileShader::isConstant ( int  ) const
inlineprotectedvirtual

Reimplemented in skgpu::graphite::PrecompileLocalMatrixShader, and skgpu::graphite::PrecompileCTMShader.

Definition at line 84 of file PrecompileShader.h.

84{ return false; }

◆ makeWithColorFilter()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShader::makeWithColorFilter ( sk_sp< PrecompileColorFilter cf)

This is the Precompile correlate to SkShader::makeWithColorFilter. The PrecompileShaders::ColorFilter factory can be used to generate a set of shaders that would've been generated via multiple makeWithColorFilter calls. That is, rather than performing: sk_sp<PrecompileShader> option1 = source->makeWithColorFilter(colorFilter1); sk_sp<PrecompileShader> option2 = source->makeWithColorFilter(colorFilter2); one could call: sk_sp<PrecompileShader> combinedOptions = ColorFilter({ source }, { colorFilter1, colorFilter2 }); With an alternative use case one could also use the ColorFilter factory thusly: sk_sp<PrecompileShader> combinedOptions = ColorFilter({ source1, source2 }, { colorFilter });

Definition at line 44 of file PrecompileShader.cpp.

44 {
45 if (!cf) {
46 return sk_ref_sp(this);
47 }
48
49 return PrecompileShaders::ColorFilter({ sk_ref_sp(this) }, { std::move(cf) });
50}
sk_sp< T > sk_ref_sp(T *obj)
Definition: SkRefCnt.h:381
SK_API sk_sp< PrecompileShader > ColorFilter(SkSpan< const sk_sp< PrecompileShader > > shaders, SkSpan< const sk_sp< PrecompileColorFilter > > colorFilters)

◆ makeWithLocalMatrix()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShader::makeWithLocalMatrix ( )

This is the Precompile correlate to SkShader::makeWithLocalMatrix. The actual matrix involved is abstracted away since it doesn't impact the generated shader. The PrecompileShaders::LocalMatrix factory can be used to generate a set of shaders that would've been generated via multiple makeWithLocalMatrix calls. That is, rather than performing: sk_sp<PrecompileShader> option1 = source1->makeWithLocalMatrix(); sk_sp<PrecompileShader> option2 = source2->makeWithLocalMatrix(); one could call: sk_sp<PrecompileShader> combinedOptions = LocalMatrix({ source1, source2 });

Definition at line 34 of file PrecompileShader.cpp.

34 {
35 if (this->priv().isALocalMatrixShader()) {
36 // SkShader::makeWithLocalMatrix collapses chains of localMatrix shaders so we need to
37 // follow suit here
38 return sk_ref_sp(this);
39 }
40
42}
virtual bool isALocalMatrixShader() const
SK_API sk_sp< PrecompileShader > LocalMatrix(SkSpan< const sk_sp< PrecompileShader > > wrapped)

◆ makeWithWorkingColorSpace()

sk_sp< PrecompileShader > skgpu::graphite::PrecompileShader::makeWithWorkingColorSpace ( sk_sp< SkColorSpace cs)

This is the Precompile correlate to SkShader::makeWithWorkingColorSpace. The PrecompileShaders::WorkingColorSpace factory can be used to generate a set of shaders that would've been generated via multiple makeWithWorkingColorSpace calls. That is, rather than performing: sk_sp<PrecompileShader> option1 = source->makeWithWorkingColorSpace(colorSpace1); sk_sp<PrecompileShader> option2 = source->makeWithWorkingColorSpace(colorSpace2); one could call: sk_sp<PrecompileShader> combinedOptions = WorkingColorSpace({ source }, { colorSpace1, colorSpace2 }); With an alternative use case one could also use the WorkingColorSpace factory thusly: sk_sp<PrecompileShader> combinedOptions = WorkingColorSpace({ source1, source2 }, { colorSpace });

Definition at line 52 of file PrecompileShader.cpp.

52 {
53 if (!cs) {
54 return sk_ref_sp(this);
55 }
56
57 return PrecompileShaders::WorkingColorSpace({ sk_ref_sp(this) }, { std::move(cs) });
58}
SK_API sk_sp< PrecompileShader > WorkingColorSpace(SkSpan< const sk_sp< PrecompileShader > > shaders, SkSpan< const sk_sp< SkColorSpace > > colorSpaces)

◆ priv() [1/2]

PrecompileShaderPriv skgpu::graphite::PrecompileShader::priv ( )
inline

Definition at line 55 of file PrecompileShaderPriv.h.

55{ return PrecompileShaderPriv(this); }

◆ priv() [2/2]

const PrecompileShaderPriv skgpu::graphite::PrecompileShader::priv ( ) const
inline

Definition at line 58 of file PrecompileShaderPriv.h.

58 {
59 return PrecompileShaderPriv(const_cast<PrecompileShader *>(this));
60}

Friends And Related Function Documentation

◆ PrecompileShaderPriv

friend class PrecompileShaderPriv
friend

Definition at line 79 of file PrecompileShader.h.


The documentation for this class was generated from the following files: