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

#include <PaintOption.h>

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 25 of file PaintOption.h.

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 27 of file PaintOption.h.

35 : fOpaquePaintColor(opaquePaintColor)
36 , fFinalBlender(finalBlender)
37 , fShader(shader)
38 , fColorFilter(colorFilter)
39 , fHasPrimitiveBlender(hasPrimitiveBlender)
40 , fClipShader(clipShader)
41 , fDstReadReq(dstReadReq)
42 , fDither(dither) {
43 }
const PrecompileBlender * finalBlender() const
Definition: PaintOption.h:45

Member Function Documentation

◆ finalBlender()

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

Definition at line 45 of file PaintOption.h.

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

◆ toKey()

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

Definition at line 25 of file PaintOption.cpp.

27 {
28 this->handleDstRead(keyContext, keyBuilder, gatherer);
29
30 std::optional<SkBlendMode> finalBlendMode = this->finalBlender()
31 ? this->finalBlender()->priv().asBlendMode()
33 if (fDstReadReq != DstReadRequirement::kNone) {
34 // In this case the blend will have been handled by shader-based blending with the dstRead.
35 finalBlendMode = SkBlendMode::kSrc;
36 }
37
38 if (fClipShader.first) {
39 ClipShaderBlock::BeginBlock(keyContext, keyBuilder, gatherer);
40 fClipShader.first->priv().addToKey(keyContext, keyBuilder, gatherer,
41 fClipShader.second);
42 keyBuilder->endBlock();
43 }
44
45 // Set the hardware blend mode.
46 SkASSERT(finalBlendMode);
47 BuiltInCodeSnippetID fixedFuncBlendModeID = static_cast<BuiltInCodeSnippetID>(
48 kFixedFunctionBlendModeIDOffset + static_cast<int>(*finalBlendMode));
49
50 keyBuilder->addBlock(fixedFuncBlendModeID);
51}
#define SkASSERT(cond)
Definition: SkAssert.h:116
@ kSrcOver
r = s + (1-sa)*d
std::optional< SkBlendMode > asBlendMode() const
static constexpr int kFixedFunctionBlendModeIDOffset
static void BeginBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *)
Definition: KeyHelpers.cpp:961

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