Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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

◆ 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)
virtual std::optional< SkBlendMode > asBlendMode() const

◆ 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
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 338 of file PaintParams.cpp.

339 {
340 if (fShader) {
341 NotifyImagesInUse(recorder, drawContext, fShader.get());
342 }
343 if (fPrimitiveBlender) {
344 NotifyImagesInUse(recorder, drawContext, fPrimitiveBlender.get());
345 }
346 if (fColorFilter) {
347 NotifyImagesInUse(recorder, drawContext, fColorFilter.get());
348 }
349 if (fFinalBlender) {
350 NotifyImagesInUse(recorder, drawContext, fFinalBlender.get());
351 }
352 if (fClipShader) {
353 NotifyImagesInUse(recorder, drawContext, fClipShader.get());
354 }
355}
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 310 of file PaintParams.cpp.

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

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