Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
PDLCDXferProcessor Class Reference
Inheritance diagram for PDLCDXferProcessor:
GrXferProcessor GrProcessor GrNonAtomicRef< GrXferProcessor > SkNoncopyable

Public Member Functions

const char * name () const override
 
std::unique_ptr< ProgramImplmakeProgramImpl () const override
 
- Public Member Functions inherited from GrXferProcessor
void addToKey (const GrShaderCaps &, skgpu::KeyBuilder *, const GrSurfaceOrigin *originIfDstTexture, bool usesInputAttachmentForDstRead) const
 
virtual GrXferBarrierType xferBarrierType (const GrCaps &caps) const
 
skgpu::BlendInfo getBlendInfo () const
 
bool willReadDstColor () const
 
bool hasSecondaryOutput () const
 
bool isLCD () const
 
bool isEqual (const GrXferProcessor &that) 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
 
- Public Member Functions inherited from GrNonAtomicRef< GrXferProcessor >
 GrNonAtomicRef ()
 
bool unique () const
 
int refCnt () const
 
void ref () const
 
void unref () const
 
- Public Member Functions inherited from SkNoncopyable
 SkNoncopyable ()=default
 
 SkNoncopyable (SkNoncopyable &&)=default
 
SkNoncopyableoperator= (SkNoncopyable &&)=default
 

Static Public Member Functions

static sk_sp< const GrXferProcessorMake (SkBlendMode mode, const GrProcessorAnalysisColor &inputColor)
 

Private Member Functions

void onAddToKey (const GrShaderCaps &, skgpu::KeyBuilder *) const override
 
void onGetBlendInfo (skgpu::BlendInfo *blendInfo) const override
 
bool onIsEqual (const GrXferProcessor &xpBase) 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 Member Functions inherited from GrXferProcessor
 GrXferProcessor (ClassID classID)
 
 GrXferProcessor (ClassID classID, bool willReadDstColor, GrProcessorAnalysisCoverage)
 
- Protected Member Functions inherited from GrProcessor
 GrProcessor (ClassID classID)
 
 GrProcessor (const GrProcessor &)=delete
 
GrProcessoroperator= (const GrProcessor &)=delete
 
- Protected Attributes inherited from GrProcessor
const ClassID fClassID
 

Detailed Description

Definition at line 212 of file GrPorterDuffXferProcessor.cpp.

Member Function Documentation

◆ Make()

sk_sp< const GrXferProcessor > PDLCDXferProcessor::Make ( SkBlendMode  mode,
const GrProcessorAnalysisColor inputColor 
)
static

Definition at line 253 of file GrPorterDuffXferProcessor.cpp.

254 {
255 if (SkBlendMode::kSrcOver != mode) {
256 return nullptr;
257 }
258 SkPMColor4f blendConstantPM;
259 if (!color.isConstant(&blendConstantPM)) {
260 return nullptr;
261 }
262 SkColor4f blendConstantUPM = blendConstantPM.unpremul();
263 float alpha = blendConstantUPM.fA;
264 blendConstantPM = { blendConstantUPM.fR, blendConstantUPM.fG, blendConstantUPM.fB, 1 };
265 return sk_sp<GrXferProcessor>(new PDLCDXferProcessor(blendConstantPM, alpha));
266}
SkColor4f color
@ kSrcOver
r = s + (1-sa)*d
SkRGBA4f< kUnpremul_SkAlphaType > unpremul() const
Definition SkColor.h:395

◆ makeProgramImpl()

std::unique_ptr< GrXferProcessor::ProgramImpl > PDLCDXferProcessor::makeProgramImpl ( ) const
overridevirtual

Returns a new instance of the appropriate GL implementation class for the given GrXferProcessor; caller is responsible for deleting the object.

Implements GrXferProcessor.

Definition at line 268 of file GrPorterDuffXferProcessor.cpp.

268 {
269 class Impl : public ProgramImpl {
270 private:
271 void emitOutputsForBlendState(const EmitArgs& args) override {
272 const char* alpha;
273 fAlphaUniform = args.fUniformHandler->addUniform(nullptr,
276 "alpha",
277 &alpha);
278 GrGLSLXPFragmentBuilder* fragBuilder = args.fXPFragBuilder;
279 // We want to force our primary output to be alpha * Coverage, where alpha is the alpha
280 // value of the src color. We know that there are no color stages (or we wouldn't have
281 // created this xp) and the r,g, and b channels of the op's input color are baked into
282 // the blend constant.
283 SkASSERT(args.fInputCoverage);
284 fragBuilder->codeAppendf("%s = %s * %s;",
285 args.fOutputPrimary,
286 alpha, args.fInputCoverage);
287 }
288
289 void onSetData(const GrGLSLProgramDataManager& pdm, const GrXferProcessor& xp) override {
290 float alpha = xp.cast<PDLCDXferProcessor>().fAlpha;
291 if (fLastAlpha != alpha) {
292 pdm.set1f(fAlphaUniform, alpha);
293 fLastAlpha = alpha;
294 }
295 }
296
298 float fLastAlpha = SK_FloatNaN;
299 };
300
301 return std::make_unique<Impl>();
302}
@ kFragment_GrShaderFlag
#define SkASSERT(cond)
Definition SkAssert.h:116
constexpr float SK_FloatNaN
virtual void set1f(UniformHandle, float v0) const =0
void codeAppendf(const char format[],...) SK_PRINTF_LIKE(2
GrGLSLProgramDataManager::UniformHandle UniformHandle
const T & cast() const
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args

◆ name()

const char * PDLCDXferProcessor::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 217 of file GrPorterDuffXferProcessor.cpp.

217{ return "Porter Duff LCD"; }

◆ onAddToKey()

void PDLCDXferProcessor::onAddToKey ( const GrShaderCaps ,
skgpu::KeyBuilder  
) const
inlineoverrideprivatevirtual

Adds a key on the skgpu::KeyBuilder that reflects any variety in the code that may be emitted by the xfer processor subclass.

Implements GrXferProcessor.

Definition at line 224 of file GrPorterDuffXferProcessor.cpp.

224{}

◆ onGetBlendInfo()

void PDLCDXferProcessor::onGetBlendInfo ( skgpu::BlendInfo ) const
inlineoverrideprivatevirtual

If we are not performing a dst read, retrieves the fixed-function blend state required by the subclass. When using dst reads, the base class controls the fixed-function blend state and this method will not be called. The BlendInfo struct comes initialized to "no blending".

Reimplemented from GrXferProcessor.

Definition at line 226 of file GrPorterDuffXferProcessor.cpp.

226 {
227 blendInfo->fSrcBlend = skgpu::BlendCoeff::kConstC;
228 blendInfo->fDstBlend = skgpu::BlendCoeff::kISC;
229 blendInfo->fBlendConstant = fBlendConstant;
230 }

◆ onIsEqual()

bool PDLCDXferProcessor::onIsEqual ( const GrXferProcessor xpBase) const
inlineoverrideprivatevirtual

Implements GrXferProcessor.

Definition at line 232 of file GrPorterDuffXferProcessor.cpp.

232 {
233 const PDLCDXferProcessor& xp = xpBase.cast<PDLCDXferProcessor>();
234 if (fBlendConstant != xp.fBlendConstant || fAlpha != xp.fAlpha) {
235 return false;
236 }
237 return true;
238 }

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