Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
GrColorSpaceXformEffect Class Reference

#include <GrColorSpaceXform.h>

Inheritance diagram for GrColorSpaceXformEffect:
GrFragmentProcessor GrProcessor

Public Member Functions

const char * name () const override
 
std::unique_ptr< GrFragmentProcessorclone () const override
 
const GrColorSpaceXformcolorXform () const
 
- Public Member Functions inherited from GrFragmentProcessor
const GrFragmentProcessorparent () const
 
std::unique_ptr< ProgramImplmakeProgramImpl () const
 
void addToKey (const GrShaderCaps &caps, skgpu::KeyBuilder *b) const
 
int numChildProcessors () const
 
int numNonNullChildProcessors () const
 
GrFragmentProcessorchildProcessor (int index)
 
const GrFragmentProcessorchildProcessor (int index) const
 
 SkDEBUGCODE (bool isInstantiated() const ;) bool willReadDstColor() const
 
bool isBlendFunction () const
 
bool usesSampleCoordsDirectly () const
 
bool usesSampleCoords () const
 
const SkSL::SampleUsagesampleUsage () const
 
bool compatibleWithCoverageAsAlpha () const
 
bool preservesOpaqueInput () const
 
bool hasConstantOutputForConstantInput (SkPMColor4f inputColor, SkPMColor4f *outputColor) const
 
bool hasConstantOutputForConstantInput () const
 
void clearConstantOutputForConstantInputFlag ()
 
bool isEqual (const GrFragmentProcessor &that) const
 
void visitProxies (const GrVisitProxyFunc &) const
 
void visitTextureEffects (const std::function< void(const GrTextureEffect &)> &) const
 
void visitWithImpls (const std::function< void(const GrFragmentProcessor &, ProgramImpl &)> &, ProgramImpl &) const
 
GrTextureEffectasTextureEffect ()
 
const GrTextureEffectasTextureEffect () const
 
- Public Member Functions inherited from GrProcessor
virtual ~GrProcessor ()=default
 
void * operator new (size_t size)
 
void * operator new (size_t object_size, size_t footer_size)
 
void operator delete (void *target)
 
void * operator new (size_t size, void *placement)
 
void operator delete (void *target, void *placement)
 
template<typename T >
const Tcast () const
 
ClassID classID () const
 

Static Public Member Functions

static std::unique_ptr< GrFragmentProcessorMake (std::unique_ptr< GrFragmentProcessor > child, SkColorSpace *src, SkAlphaType srcAT, SkColorSpace *dst, SkAlphaType dstAT)
 
static std::unique_ptr< GrFragmentProcessorMake (std::unique_ptr< GrFragmentProcessor > child, const GrColorInfo &srcInfo, const GrColorInfo &dstInfo)
 
static std::unique_ptr< GrFragmentProcessorMake (std::unique_ptr< GrFragmentProcessor > child, sk_sp< GrColorSpaceXform > colorXform)
 
- Static Public Member Functions inherited from GrFragmentProcessor
static std::unique_ptr< GrFragmentProcessorMakeColor (SkPMColor4f color)
 
static std::unique_ptr< GrFragmentProcessorMulInputByChildAlpha (std::unique_ptr< GrFragmentProcessor > child)
 
static std::unique_ptr< GrFragmentProcessorApplyPaintAlpha (std::unique_ptr< GrFragmentProcessor > child)
 
static std::unique_ptr< GrFragmentProcessorModulateRGBA (std::unique_ptr< GrFragmentProcessor > child, const SkPMColor4f &color)
 
static std::unique_ptr< GrFragmentProcessorOverrideInput (std::unique_ptr< GrFragmentProcessor >, const SkPMColor4f &)
 
static std::unique_ptr< GrFragmentProcessorDisableCoverageAsAlpha (std::unique_ptr< GrFragmentProcessor >)
 
static std::unique_ptr< GrFragmentProcessorDestColor ()
 
static std::unique_ptr< GrFragmentProcessorSwizzleOutput (std::unique_ptr< GrFragmentProcessor >, const skgpu::Swizzle &)
 
static std::unique_ptr< GrFragmentProcessorClampOutput (std::unique_ptr< GrFragmentProcessor >)
 
static std::unique_ptr< GrFragmentProcessorCompose (std::unique_ptr< GrFragmentProcessor > f, std::unique_ptr< GrFragmentProcessor > g)
 
static std::unique_ptr< GrFragmentProcessorColorMatrix (std::unique_ptr< GrFragmentProcessor > child, const float matrix[20], bool unpremulInput, bool clampRGBOutput, bool premulOutput)
 
static std::unique_ptr< GrFragmentProcessorSurfaceColor ()
 
static std::unique_ptr< GrFragmentProcessorDeviceSpace (std::unique_ptr< GrFragmentProcessor >)
 
static std::unique_ptr< GrFragmentProcessorRect (std::unique_ptr< GrFragmentProcessor >, GrClipEdgeType, SkRect)
 
static GrFPResult Circle (std::unique_ptr< GrFragmentProcessor >, GrClipEdgeType, SkPoint center, float radius)
 
static GrFPResult Ellipse (std::unique_ptr< GrFragmentProcessor >, GrClipEdgeType, SkPoint center, SkPoint radii, const GrShaderCaps &)
 
static std::unique_ptr< GrFragmentProcessorHighPrecision (std::unique_ptr< GrFragmentProcessor >)
 

Private Member Functions

SkPMColor4f constantOutputForConstantInput (const SkPMColor4f &input) const override
 
std::unique_ptr< ProgramImplonMakeProgramImpl () const override
 
void onAddToKey (const GrShaderCaps &, skgpu::KeyBuilder *) const override
 
bool onIsEqual (const GrFragmentProcessor &) const override
 

Additional Inherited Members

- Public Types inherited from GrProcessor
enum  ClassID {
  kNull_ClassID , kAttributeTestProcessor_ClassID , kBigKeyProcessor_ClassID , kBlendFragmentProcessor_ClassID ,
  kBlockInputFragmentProcessor_ClassID , kButtCapStrokedCircleGeometryProcessor_ClassID , kCircleGeometryProcessor_ClassID , kCircularRRectEffect_ClassID ,
  kClockwiseTestProcessor_ClassID , kColorTableEffect_ClassID , kCoverageSetOpXP_ClassID , kCustomXP_ClassID ,
  kDashingCircleEffect_ClassID , kDashingLineEffect_ClassID , kDefaultGeoProc_ClassID , kDeviceSpace_ClassID ,
  kDIEllipseGeometryProcessor_ClassID , kDisableColorXP_ClassID , kDrawAtlasPathShader_ClassID , kEllipseGeometryProcessor_ClassID ,
  kEllipticalRRectEffect_ClassID , kFwidthSquircleTestProcessor_ClassID , kGP_ClassID , kGrBicubicEffect_ClassID ,
  kGrBitmapTextGeoProc_ClassID , kGrColorSpaceXformEffect_ClassID , kGrConicEffect_ClassID , kGrConvexPolyEffect_ClassID ,
  kGrDiffuseLightingEffect_ClassID , kGrDisplacementMapEffect_ClassID , kGrDistanceFieldA8TextGeoProc_ClassID , kGrDistanceFieldLCDTextGeoProc_ClassID ,
  kGrDistanceFieldPathGeoProc_ClassID , kGrFillRRectOp_Processor_ClassID , kGrGaussianConvolutionFragmentProcessor_ClassID , kGrMatrixConvolutionEffect_ClassID ,
  kGrMatrixEffect_ClassID , kGrMeshTestProcessor_ClassID , kGrMorphologyEffect_ClassID , kGrPerlinNoise2Effect_ClassID ,
  kGrPipelineDynamicStateTestProcessor_ClassID , kGrQuadEffect_ClassID , kGrRRectShadowGeoProc_ClassID , kGrSkSLFP_ClassID ,
  kGrSpecularLightingEffect_ClassID , kGrTextureEffect_ClassID , kGrUnrolledBinaryGradientColorizer_ClassID , kGrYUVtoRGBEffect_ClassID ,
  kHighPrecisionFragmentProcessor_ClassID , kLatticeGP_ClassID , kPDLCDXferProcessor_ClassID , kPorterDuffXferProcessor_ClassID ,
  kPremulFragmentProcessor_ClassID , kQuadEdgeEffect_ClassID , kQuadPerEdgeAAGeometryProcessor_ClassID , kSeriesFragmentProcessor_ClassID ,
  kShaderPDXferProcessor_ClassID , kSurfaceColorProcessor_ClassID , kSwizzleFragmentProcessor_ClassID , kTessellate_BoundingBoxShader_ClassID ,
  kTessellate_GrModulateAtlasCoverageEffect_ClassID , kTessellate_GrStrokeTessellationShader_ClassID , kTessellate_HullShader_ClassID , kTessellate_MiddleOutShader_ClassID ,
  kTessellate_SimpleTriangleShader_ClassID , kTessellationTestTriShader_ClassID , kTestFP_ClassID , kTestRectOp_ClassID ,
  kVertexColorSpaceBenchGP_ClassID , kVerticesGP_ClassID
}
 
- Protected Types inherited from GrFragmentProcessor
enum  OptimizationFlags : uint32_t {
  kNone_OptimizationFlags , kCompatibleWithCoverageAsAlpha_OptimizationFlag = 0x1 , kPreservesOpaqueInput_OptimizationFlag = 0x2 , kConstantOutputForConstantInput_OptimizationFlag = 0x4 ,
  kAll_OptimizationFlags
}
 
- Protected Member Functions inherited from GrFragmentProcessor
 GrFragmentProcessor (ClassID classID, OptimizationFlags optimizationFlags)
 
 GrFragmentProcessor (const GrFragmentProcessor &src)
 
OptimizationFlags optimizationFlags () const
 
void registerChild (std::unique_ptr< GrFragmentProcessor > child, SkSL::SampleUsage sampleUsage=SkSL::SampleUsage::PassThrough())
 
void cloneAndRegisterAllChildProcessors (const GrFragmentProcessor &src)
 
void setUsesSampleCoordsDirectly ()
 
void setWillReadDstColor ()
 
void setIsBlendFunction ()
 
void mergeOptimizationFlags (OptimizationFlags flags)
 
- Protected Member Functions inherited from GrProcessor
 GrProcessor (ClassID classID)
 
 GrProcessor (const GrProcessor &)=delete
 
GrProcessoroperator= (const GrProcessor &)=delete
 
- Static Protected Member Functions inherited from GrFragmentProcessor
static OptimizationFlags ModulateForSamplerOptFlags (SkAlphaType alphaType, bool samplingDecal)
 
static OptimizationFlags ModulateForClampedSamplerOptFlags (SkAlphaType alphaType)
 
static OptimizationFlags ProcessorOptimizationFlags (const GrFragmentProcessor *fp)
 
static SkPMColor4f ConstantOutputForConstantInput (const GrFragmentProcessor *fp, const SkPMColor4f &input)
 
- Protected Attributes inherited from GrProcessor
const ClassID fClassID
 

Detailed Description

Definition at line 57 of file GrColorSpaceXform.h.

Member Function Documentation

◆ clone()

std::unique_ptr< GrFragmentProcessor > GrColorSpaceXformEffect::clone ( ) const
overridevirtual

Makes a copy of this fragment processor that draws equivalently to the original. If the processor has child processors they are cloned as well.

Implements GrFragmentProcessor.

Definition at line 101 of file GrColorSpaceXform.cpp.

101 {
102 return std::unique_ptr<GrFragmentProcessor>(new GrColorSpaceXformEffect(*this));
103}

◆ colorXform()

const GrColorSpaceXform * GrColorSpaceXformEffect::colorXform ( ) const
inline

Definition at line 81 of file GrColorSpaceXform.h.

81{ return fColorXform.get(); }
T * get() const
Definition SkRefCnt.h:303

◆ constantOutputForConstantInput()

SkPMColor4f GrColorSpaceXformEffect::constantOutputForConstantInput ( const SkPMColor4f input) const
overrideprivatevirtual

Reimplemented from GrFragmentProcessor.

Definition at line 153 of file GrColorSpaceXform.cpp.

154 {
155 const auto c0 = ConstantOutputForConstantInput(this->childProcessor(0), input);
156 return this->fColorXform->apply(c0.unpremul()).premul();
157}
SkColor4f apply(const SkColor4f &srcColor)
GrFragmentProcessor * childProcessor(int index)
static SkPMColor4f ConstantOutputForConstantInput(const GrFragmentProcessor *fp, const SkPMColor4f &input)

◆ Make() [1/3]

std::unique_ptr< GrFragmentProcessor > GrColorSpaceXformEffect::Make ( std::unique_ptr< GrFragmentProcessor child,
const GrColorInfo srcInfo,
const GrColorInfo dstInfo 
)
static

Definition at line 166 of file GrColorSpaceXform.cpp.

169 {
170 return Make(std::move(child), GrColorSpaceXform::Make(srcInfo, dstInfo));
171}
static std::unique_ptr< GrFragmentProcessor > Make(std::unique_ptr< GrFragmentProcessor > child, SkColorSpace *src, SkAlphaType srcAT, SkColorSpace *dst, SkAlphaType dstAT)
static sk_sp< GrColorSpaceXform > Make(SkColorSpace *src, SkAlphaType srcAT, SkColorSpace *dst, SkAlphaType dstAT)

◆ Make() [2/3]

std::unique_ptr< GrFragmentProcessor > GrColorSpaceXformEffect::Make ( std::unique_ptr< GrFragmentProcessor child,
sk_sp< GrColorSpaceXform colorXform 
)
static

Returns a fragment processor that calls the passed in FP and then converts it with the given color xform. If the child is null, fInputColor is used. Returns child as-is if the xform is null (i.e. a no-op).

Definition at line 173 of file GrColorSpaceXform.cpp.

175 {
176 if (!colorXform) {
177 return child;
178 }
179
180 return std::unique_ptr<GrFragmentProcessor>(new GrColorSpaceXformEffect(std::move(child),
181 std::move(colorXform)));
182}
const GrColorSpaceXform * colorXform() const

◆ Make() [3/3]

std::unique_ptr< GrFragmentProcessor > GrColorSpaceXformEffect::Make ( std::unique_ptr< GrFragmentProcessor child,
SkColorSpace src,
SkAlphaType  srcAT,
SkColorSpace dst,
SkAlphaType  dstAT 
)
static

Returns a fragment processor that calls the passed in fragment processor, and then converts the color space of the output from src to dst. If the child is null, fInputColor is used.

Definition at line 159 of file GrColorSpaceXform.cpp.

162 {
163 return Make(std::move(child), GrColorSpaceXform::Make(src, srcAT, dst, dstAT));
164}

◆ name()

const char * GrColorSpaceXformEffect::name ( ) const
inlineoverridevirtual

Human-meaningful string to identify this processor; may be embedded in generated shader code and must be a legal SkSL identifier prefix.

Implements GrProcessor.

Definition at line 78 of file GrColorSpaceXform.h.

78{ return "ColorSpaceXform"; }

◆ onAddToKey()

void GrColorSpaceXformEffect::onAddToKey ( const GrShaderCaps ,
skgpu::KeyBuilder b 
) const
overrideprivatevirtual

Implements GrFragmentProcessor.

Definition at line 110 of file GrColorSpaceXform.cpp.

110 {
111 b->add32(GrColorSpaceXform::XformKey(fColorXform.get()));
112}
static uint32_t XformKey(const GrColorSpaceXform *xform)
static bool b

◆ onIsEqual()

bool GrColorSpaceXformEffect::onIsEqual ( const GrFragmentProcessor ) const
overrideprivatevirtual

Subclass implements this to support isEqual(). It will only be called if it is known that the two processors are of the same subclass (i.e. have the same ClassID).

Implements GrFragmentProcessor.

Definition at line 105 of file GrColorSpaceXform.cpp.

105 {
107 return GrColorSpaceXform::Equals(fColorXform.get(), other.fColorXform.get());
108}
static bool Equals(const GrColorSpaceXform *a, const GrColorSpaceXform *b)
struct MyStruct s

◆ onMakeProgramImpl()

std::unique_ptr< GrFragmentProcessor::ProgramImpl > GrColorSpaceXformEffect::onMakeProgramImpl ( ) const
overrideprivatevirtual

Returns a new instance of the appropriate ProgramImpl subclass for the given GrFragmentProcessor. It will emit the appropriate code and live with the cached program to setup uniform data for each draw that uses the program.

Implements GrFragmentProcessor.

Definition at line 115 of file GrColorSpaceXform.cpp.

115 {
116 class Impl : public ProgramImpl {
117 public:
118 void emitCode(EmitArgs& args) override {
120 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
121 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
122
123 fColorSpaceHelper.emitCode(uniformHandler, proc.colorXform());
124
125 SkString childColor = this->invokeChild(0, args);
126
127 SkString xformedColor;
128 fragBuilder->appendColorGamutXform(
129 &xformedColor, childColor.c_str(), &fColorSpaceHelper);
130 fragBuilder->codeAppendf("return %s;", xformedColor.c_str());
131 }
132
133 private:
134 void onSetData(const GrGLSLProgramDataManager& pdman,
135 const GrFragmentProcessor& fp) override {
137 fColorSpaceHelper.setData(pdman, proc.colorXform());
138 }
139
140 GrGLSLColorSpaceXformHelper fColorSpaceHelper;
141 };
142
143 return std::make_unique<Impl>();
144}
const T & cast() const
const char * c_str() const
Definition SkString.h:133
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
const uint32_t fp

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