28 this->handleDstRead(keyContext, keyBuilder, gatherer);
30 std::optional<SkBlendMode> finalBlendMode = this->
finalBlender()
38 if (fClipShader.first) {
40 fClipShader.first->priv().addToKey(keyContext, keyBuilder, gatherer,
50 keyBuilder->
addBlock(fixedFuncBlendModeID);
53void PaintOption::addPaintColorToKey(
const KeyContext& keyContext,
57 fShader.first->priv().addToKey(keyContext,
builder, gatherer, fShader.second);
63void PaintOption::handlePrimitiveColor(
const KeyContext& keyContext,
64 PaintParamsKeyBuilder* keyBuilder,
65 PipelineDataGatherer* gatherer)
const {
66 if (fHasPrimitiveBlender) {
67 Blend(keyContext, keyBuilder, gatherer,
71 AddToKey(keyContext, keyBuilder, gatherer,
75 this->addPaintColorToKey(keyContext, keyBuilder, gatherer);
81 this->addPaintColorToKey(keyContext, keyBuilder, gatherer);
85void PaintOption::handlePaintAlpha(
const KeyContext& keyContext,
86 PaintParamsKeyBuilder* keyBuilder,
87 PipelineDataGatherer* gatherer)
const {
89 if (!fShader.first && !fHasPrimitiveBlender) {
96 if (!fOpaquePaintColor) {
97 Blend(keyContext, keyBuilder, gatherer,
102 this->handlePrimitiveColor(keyContext, keyBuilder, gatherer);
108 this->handlePrimitiveColor(keyContext, keyBuilder, gatherer);
112void PaintOption::handleColorFilter(
const KeyContext& keyContext,
113 PaintParamsKeyBuilder*
builder,
114 PipelineDataGatherer* gatherer)
const {
115 if (fColorFilter.first) {
118 this->handlePaintAlpha(keyContext,
builder, gatherer);
121 fColorFilter.first->priv().addToKey(keyContext,
builder, gatherer,
122 fColorFilter.second);
125 this->handlePaintAlpha(keyContext,
builder, gatherer);
130bool PaintOption::shouldDither(
SkColorType dstCT)
const {
146 return fShader.first && !fShader.first->priv().isConstant(fShader.second);
149void PaintOption::handleDithering(
const KeyContext& keyContext,
150 PaintParamsKeyBuilder*
builder,
151 PipelineDataGatherer* gatherer)
const {
153#ifndef SK_IGNORE_GPU_DITHER
154 SkColorType ct = keyContext.dstColorInfo().colorType();
155 if (this->shouldDither(ct)) {
158 this->handleColorFilter(keyContext,
builder, gatherer);
166 this->handleColorFilter(keyContext,
builder, gatherer);
170void PaintOption::handleDstRead(
const KeyContext& keyContext,
171 PaintParamsKeyBuilder*
builder,
172 PipelineDataGatherer* gatherer)
const {
176 if (fFinalBlender.first) {
177 fFinalBlender.first->priv().addToKey(keyContext, builder, gatherer,
178 fFinalBlender.second);
180 AddKnownModeBlend(keyContext, builder, gatherer, SkBlendMode::kSrcOver);
184 this->handleDithering(keyContext,
builder, gatherer);
190 this->handleDithering(keyContext,
builder, gatherer);
@ kSrcOver
r = s + (1-sa)*d
constexpr SkPMColor4f SK_PMColor4fWHITE
@ kARGB_4444_SkColorType
pixel with 4 bits for alpha, red, green, blue; in 16-bit word
@ kRGB_565_SkColorType
pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word
@ kUnknown_SkColorType
uninitialized
static sk_sp< SkBlender > Mode(SkBlendMode mode)
const PrecompileBlender * finalBlender() const
void toKey(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *) const
void addBlock(BuiltInCodeSnippetID id)
std::optional< SkBlendMode > asBlendMode() const
PrecompileBlenderPriv priv()
const myers::Point & get(const myers::Segment &)
static constexpr int kFixedFunctionBlendModeIDOffset
void AddToKey(const KeyContext &keyContext, PaintParamsKeyBuilder *builder, PipelineDataGatherer *gatherer, const SkBlender *blender)
void AddKnownModeBlend(const KeyContext &keyContext, PaintParamsKeyBuilder *builder, PipelineDataGatherer *gatherer, SkBlendMode bm)
void Compose(const KeyContext &keyContext, PaintParamsKeyBuilder *keyBuilder, PipelineDataGatherer *gatherer, AddToKeyFn addInnerToKey, AddToKeyFn addOuterToKey)
void AddDitherBlock(const KeyContext &keyContext, PaintParamsKeyBuilder *builder, PipelineDataGatherer *gatherer, SkColorType ct)
void AddDstReadBlock(const KeyContext &keyContext, PaintParamsKeyBuilder *builder, PipelineDataGatherer *gatherer, DstReadRequirement dstReadReq)
void Blend(const KeyContext &keyContext, PaintParamsKeyBuilder *keyBuilder, PipelineDataGatherer *gatherer, AddToKeyFn addBlendToKey, AddToKeyFn addSrcToKey, AddToKeyFn addDstToKey)
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *)
static void BeginBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *)
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *)
static void AddBlock(const KeyContext &, PaintParamsKeyBuilder *, PipelineDataGatherer *, const SkPMColor4f &)