Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
skgpu::graphite::PrecompileWorkingColorSpaceShader Class Reference
Inheritance diagram for skgpu::graphite::PrecompileWorkingColorSpaceShader:
skgpu::graphite::PrecompileShader skgpu::graphite::PrecompileBase SkRefCnt SkRefCntBase

Public Member Functions

 PrecompileWorkingColorSpaceShader (SkSpan< const sk_sp< PrecompileShader > > shaders, SkSpan< const sk_sp< SkColorSpace > > colorSpaces)
 
- Public Member Functions inherited from skgpu::graphite::PrecompileShader
 PrecompileShader ()
 
virtual bool isConstant (int desiredCombination) const
 
sk_sp< PrecompileShadermakeWithLocalMatrix ()
 
sk_sp< PrecompileShadermakeWithColorFilter (sk_sp< PrecompileColorFilter >)
 
sk_sp< PrecompileShadermakeWithWorkingColorSpace (sk_sp< SkColorSpace >)
 
sk_sp< PrecompileShadermakeWithCTM ()
 
- Public Member Functions inherited from skgpu::graphite::PrecompileBase
 PrecompileBase (Type type)
 
Type type () const
 
virtual int numIntrinsicCombinations () const
 
int numCombinations () 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
 

Private Member Functions

int numChildCombinations () const override
 
void addToKey (const KeyContext &keyContext, PaintParamsKeyBuilder *builder, PipelineDataGatherer *gatherer, int desiredCombination) const override
 

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

Definition at line 823 of file FactoryFunctions.cpp.

Constructor & Destructor Documentation

◆ PrecompileWorkingColorSpaceShader()

skgpu::graphite::PrecompileWorkingColorSpaceShader::PrecompileWorkingColorSpaceShader ( SkSpan< const sk_sp< PrecompileShader > >  shaders,
SkSpan< const sk_sp< SkColorSpace > >  colorSpaces 
)
inline

Definition at line 825 of file FactoryFunctions.cpp.

827 : fShaders(shaders.begin(), shaders.end())
828 , fColorSpaces(colorSpaces.begin(), colorSpaces.end()) {
829 fNumShaderCombos = 0;
830 for (const auto& s : fShaders) {
831 fNumShaderCombos += s->numCombinations();
832 }
833 }
constexpr T * begin() const
Definition SkSpan_impl.h:90
constexpr T * end() const
Definition SkSpan_impl.h:91
struct MyStruct s

Member Function Documentation

◆ addToKey()

void skgpu::graphite::PrecompileWorkingColorSpaceShader::addToKey ( const KeyContext keyContext,
PaintParamsKeyBuilder builder,
PipelineDataGatherer gatherer,
int  desiredCombination 
) const
inlineoverrideprivatevirtual

Implements skgpu::graphite::PrecompileBase.

Definition at line 838 of file FactoryFunctions.cpp.

841 {
842 SkASSERT(desiredCombination < this->numCombinations());
843
844 int desiredShaderCombination = desiredCombination % fNumShaderCombos;
845 int desiredColorSpaceCombination = desiredCombination / fNumShaderCombos;
846 SkASSERT(desiredColorSpaceCombination < (int) fColorSpaces.size());
847
848 const SkColorInfo& dstInfo = keyContext.dstColorInfo();
849 const SkAlphaType dstAT = dstInfo.alphaType();
850 sk_sp<SkColorSpace> dstCS = dstInfo.refColorSpace();
851 if (!dstCS) {
852 dstCS = SkColorSpace::MakeSRGB();
853 }
854
855 sk_sp<SkColorSpace> workingCS = fColorSpaces[desiredColorSpaceCombination];
856 SkColorInfo workingInfo(dstInfo.colorType(), dstAT, workingCS);
857 KeyContextWithColorInfo workingContext(keyContext, workingInfo);
858
859 Compose(keyContext, builder, gatherer,
860 /* addInnerToKey= */ [&]() -> void {
861 AddToKey<PrecompileShader>(keyContext, builder, gatherer, fShaders,
862 desiredShaderCombination);
863 },
864 /* addOuterToKey= */ [&]() -> void {
865 ColorSpaceTransformBlock::ColorSpaceTransformData data(
866 workingCS.get(), dstAT, dstCS.get(), dstAT);
867 ColorSpaceTransformBlock::AddBlock(keyContext, builder, gatherer, data);
868 });
869 }
SkAlphaType
Definition SkAlphaType.h:26
#define SkASSERT(cond)
Definition SkAssert.h:116
SkAlphaType alphaType() const
sk_sp< SkColorSpace > refColorSpace() const
SkColorType colorType() const
static sk_sp< SkColorSpace > MakeSRGB()
T * get() const
Definition SkRefCnt.h:303
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41
void Compose(const KeyContext &keyContext, PaintParamsKeyBuilder *keyBuilder, PipelineDataGatherer *gatherer, AddToKeyFn addInnerToKey, AddToKeyFn addOuterToKey)
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, const ColorSpaceTransformData &)

◆ numChildCombinations()

int skgpu::graphite::PrecompileWorkingColorSpaceShader::numChildCombinations ( ) const
inlineoverrideprivatevirtual

Reimplemented from skgpu::graphite::PrecompileBase.

Definition at line 836 of file FactoryFunctions.cpp.

836{ return fNumShaderCombos * fColorSpaces.size(); }

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