Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
skgpu::graphite::PaintOption Class Reference

Public Member Functions

 PaintOption (bool opaquePaintColor, const std::pair< sk_sp< PrecompileBlender >, int > &finalBlender, const std::pair< sk_sp< PrecompileShader >, int > &shader, const std::pair< sk_sp< PrecompileColorFilter >, int > &colorFilter, bool hasPrimitiveBlender, const std::pair< sk_sp< PrecompileShader >, int > &clipShader, DstReadRequirement dstReadReq, bool dither)
 
const PrecompileBlenderfinalBlender () const
 
void toKey (const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *) const
 

Detailed Description

Definition at line 160 of file Precompile.cpp.

Constructor & Destructor Documentation

◆ PaintOption()

skgpu::graphite::PaintOption::PaintOption ( bool  opaquePaintColor,
const std::pair< sk_sp< PrecompileBlender >, int > &  finalBlender,
const std::pair< sk_sp< PrecompileShader >, int > &  shader,
const std::pair< sk_sp< PrecompileColorFilter >, int > &  colorFilter,
bool  hasPrimitiveBlender,
const std::pair< sk_sp< PrecompileShader >, int > &  clipShader,
DstReadRequirement  dstReadReq,
bool  dither 
)
inline

Definition at line 162 of file Precompile.cpp.

170 : fOpaquePaintColor(opaquePaintColor)
171 , fFinalBlender(finalBlender)
172 , fShader(shader)
173 , fColorFilter(colorFilter)
174 , fHasPrimitiveBlender(hasPrimitiveBlender)
175 , fClipShader(clipShader)
176 , fDstReadReq(dstReadReq)
177 , fDither(dither) {
178 }
const PrecompileBlender * finalBlender() const

Member Function Documentation

◆ finalBlender()

const PrecompileBlender * skgpu::graphite::PaintOption::finalBlender ( ) const
inline

Definition at line 180 of file Precompile.cpp.

180{ return fFinalBlender.first.get(); }

◆ toKey()

void skgpu::graphite::PaintOption::toKey ( const KeyContext keyContext,
PaintParamsKeyBuilder keyBuilder,
PipelineDataGatherer gatherer 
) const

Definition at line 348 of file Precompile.cpp.

350 {
351 this->handleDstRead(keyContext, keyBuilder, gatherer);
352
353 std::optional<SkBlendMode> finalBlendMode = this->finalBlender()
354 ? this->finalBlender()->asBlendMode()
356 if (fDstReadReq != DstReadRequirement::kNone) {
357 // In this case the blend will have been handled by shader-based blending with the dstRead.
358 finalBlendMode = SkBlendMode::kSrc;
359 }
360
361 if (fClipShader.first) {
362 ClipShaderBlock::BeginBlock(keyContext, keyBuilder, gatherer);
363 fClipShader.first->priv().addToKey(keyContext, keyBuilder, gatherer,
364 fClipShader.second);
365 keyBuilder->endBlock();
366 }
367
368 // Set the hardware blend mode.
369 SkASSERT(finalBlendMode);
370 BuiltInCodeSnippetID fixedFuncBlendModeID = static_cast<BuiltInCodeSnippetID>(
371 kFixedFunctionBlendModeIDOffset + static_cast<int>(*finalBlendMode));
372
373 keyBuilder->addBlock(fixedFuncBlendModeID);
374}
#define SkASSERT(cond)
Definition SkAssert.h:116
@ kSrcOver
r = s + (1-sa)*d
virtual std::optional< SkBlendMode > asBlendMode() const
Definition Precompile.h:156
static constexpr int kFixedFunctionBlendModeIDOffset
static void BeginBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *)

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