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

#include <PaintParams.h>

Public Member Functions

 PaintParams (const SkPaint &, sk_sp< SkBlender > primitiveBlender, sk_sp< SkShader > clipShader, DstReadRequirement dstReadReq, bool skipColorXform)
 
 PaintParams (const PaintParams &)
 
 ~PaintParams ()
 
PaintParamsoperator= (const PaintParams &)
 
SkColor4f color () const
 
std::optional< SkBlendModeasFinalBlendMode () const
 
SkBlenderfinalBlender () const
 
sk_sp< SkBlenderrefFinalBlender () const
 
SkShadershader () const
 
sk_sp< SkShaderrefShader () const
 
SkColorFiltercolorFilter () const
 
sk_sp< SkColorFilterrefColorFilter () const
 
SkBlenderprimitiveBlender () const
 
sk_sp< SkBlenderrefPrimitiveBlender () const
 
DstReadRequirement dstReadRequirement () const
 
bool skipColorXform () const
 
bool dither () const
 
void toKey (const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *) const
 
void notifyImagesInUse (Recorder *, DrawContext *) const
 

Static Public Member Functions

static SkColor4f Color4fPrepForDst (SkColor4f srgb, const SkColorInfo &dstColorInfo)
 

Detailed Description

Definition at line 34 of file PaintParams.h.

Constructor & Destructor Documentation

◆ PaintParams() [1/2]

skgpu::graphite::PaintParams::PaintParams ( const SkPaint paint,
sk_sp< SkBlender primitiveBlender,
sk_sp< SkShader clipShader,
DstReadRequirement  dstReadReq,
bool  skipColorXform 
)
explicit

Definition at line 53 of file PaintParams.cpp.

58 : fColor(paint.getColor4f())
59 , fFinalBlender(paint.refBlender())
60 , fShader(paint.refShader())
61 , fColorFilter(paint.refColorFilter())
62 , fPrimitiveBlender(std::move(primitiveBlender))
63 , fClipShader(std::move(clipShader))
64 , fDstReadReq(dstReadReq)
65 , fSkipColorXform(skipColorXform)
66 , fDither(paint.isDither()) {}
SkBlender * primitiveBlender() const
Definition: PaintParams.h:59
const Paint & paint
Definition: color_source.cc:38

◆ PaintParams() [2/2]

skgpu::graphite::PaintParams::PaintParams ( const PaintParams )
default

◆ ~PaintParams()

skgpu::graphite::PaintParams::~PaintParams ( )
default

Member Function Documentation

◆ asFinalBlendMode()

std::optional< SkBlendMode > skgpu::graphite::PaintParams::asFinalBlendMode ( ) const

Definition at line 72 of file PaintParams.cpp.

72 {
73 return fFinalBlender ? as_BB(fFinalBlender)->asBlendMode()
75}
@ kSrcOver
r = s + (1-sa)*d
SkBlenderBase * as_BB(SkBlender *blend)
Definition: SkBlenderBase.h:69
virtual std::optional< SkBlendMode > asBlendMode() const
Definition: SkBlenderBase.h:45

◆ color()

SkColor4f skgpu::graphite::PaintParams::color ( ) const
inline

Definition at line 47 of file PaintParams.h.

47{ return fColor; }

◆ Color4fPrepForDst()

SkColor4f skgpu::graphite::PaintParams::Color4fPrepForDst ( SkColor4f  srgb,
const SkColorInfo dstColorInfo 
)
static

Converts an SkColor4f to the destination color space.

Definition at line 85 of file PaintParams.cpp.

85 {
86 // xform from sRGB to the destination colorspace
88 dstColorInfo.colorSpace(), kUnpremul_SkAlphaType);
89
90 SkColor4f result = srcColor;
91 steps.apply(result.vec());
92 return result;
93}
kUnpremul_SkAlphaType
SkColorSpace * sk_srgb_singleton()
SkColorSpace * colorSpace() const
Definition: SkImageInfo.cpp:66
GAsyncResult * result

◆ colorFilter()

SkColorFilter * skgpu::graphite::PaintParams::colorFilter ( ) const
inline

Definition at line 56 of file PaintParams.h.

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

◆ dither()

bool skgpu::graphite::PaintParams::dither ( ) const
inline

Definition at line 64 of file PaintParams.h.

64{ return fDither; }

◆ dstReadRequirement()

DstReadRequirement skgpu::graphite::PaintParams::dstReadRequirement ( ) const
inline

Definition at line 62 of file PaintParams.h.

62{ return fDstReadReq; }

◆ finalBlender()

SkBlender * skgpu::graphite::PaintParams::finalBlender ( ) const
inline

Definition at line 50 of file PaintParams.h.

50{ return fFinalBlender.get(); }

◆ notifyImagesInUse()

void skgpu::graphite::PaintParams::notifyImagesInUse ( Recorder recorder,
DrawContext drawContext 
) const

Definition at line 339 of file PaintParams.cpp.

340 {
341 if (fShader) {
342 NotifyImagesInUse(recorder, drawContext, fShader.get());
343 }
344 if (fPrimitiveBlender) {
345 NotifyImagesInUse(recorder, drawContext, fPrimitiveBlender.get());
346 }
347 if (fColorFilter) {
348 NotifyImagesInUse(recorder, drawContext, fColorFilter.get());
349 }
350 if (fFinalBlender) {
351 NotifyImagesInUse(recorder, drawContext, fFinalBlender.get());
352 }
353 if (fClipShader) {
354 NotifyImagesInUse(recorder, drawContext, fClipShader.get());
355 }
356}
void NotifyImagesInUse(Recorder *recorder, DrawContext *drawContext, const SkBlender *blender)

◆ operator=()

PaintParams & skgpu::graphite::PaintParams::operator= ( const PaintParams )
default

◆ primitiveBlender()

SkBlender * skgpu::graphite::PaintParams::primitiveBlender ( ) const
inline

Definition at line 59 of file PaintParams.h.

59{ return fPrimitiveBlender.get(); }

◆ refColorFilter()

sk_sp< SkColorFilter > skgpu::graphite::PaintParams::refColorFilter ( ) const

Definition at line 81 of file PaintParams.cpp.

81{ return fColorFilter; }

◆ refFinalBlender()

sk_sp< SkBlender > skgpu::graphite::PaintParams::refFinalBlender ( ) const

Definition at line 77 of file PaintParams.cpp.

77{ return fFinalBlender; }

◆ refPrimitiveBlender()

sk_sp< SkBlender > skgpu::graphite::PaintParams::refPrimitiveBlender ( ) const

Definition at line 83 of file PaintParams.cpp.

83{ return fPrimitiveBlender; }

◆ refShader()

sk_sp< SkShader > skgpu::graphite::PaintParams::refShader ( ) const

Definition at line 79 of file PaintParams.cpp.

79{ return fShader; }

◆ shader()

SkShader * skgpu::graphite::PaintParams::shader ( ) const
inline

Definition at line 53 of file PaintParams.h.

53{ return fShader.get(); }

◆ skipColorXform()

bool skgpu::graphite::PaintParams::skipColorXform ( ) const
inline

Definition at line 63 of file PaintParams.h.

63{ return fSkipColorXform; }

◆ toKey()

void skgpu::graphite::PaintParams::toKey ( const KeyContext keyContext,
PaintParamsKeyBuilder builder,
PipelineDataGatherer gatherer 
) const

Definition at line 311 of file PaintParams.cpp.

313 {
314 this->handleDstRead(keyContext, builder, gatherer);
315
316 std::optional<SkBlendMode> finalBlendMode = this->asFinalBlendMode();
317 if (fDstReadReq != DstReadRequirement::kNone) {
318 // In this case the blend will have been handled by shader-based blending with the dstRead.
319 finalBlendMode = SkBlendMode::kSrc;
320 }
321
322 if (fClipShader) {
323 ClipShaderBlock::BeginBlock(keyContext, builder, gatherer);
324
325 AddToKey(keyContext, builder, gatherer, fClipShader.get());
326
327 builder->endBlock();
328 }
329
330 // Set the hardware blend mode.
331 SkASSERT(finalBlendMode);
332 BuiltInCodeSnippetID fixedFuncBlendModeID = static_cast<BuiltInCodeSnippetID>(
333 kFixedFunctionBlendModeIDOffset + static_cast<int>(*finalBlendMode));
334
335 builder->addBlock(fixedFuncBlendModeID);
336}
#define SkASSERT(cond)
Definition: SkAssert.h:116
std::optional< SkBlendMode > asFinalBlendMode() const
Definition: PaintParams.cpp:72
static constexpr int kFixedFunctionBlendModeIDOffset
void AddToKey(const KeyContext &keyContext, PaintParamsKeyBuilder *builder, PipelineDataGatherer *gatherer, const SkBlender *blender)
static void BeginBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *)
Definition: KeyHelpers.cpp:961

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