plumb matrix provider through skvm shaders

Trickiest bit is probably the override provider in kSampleExplicit?

Change-Id: Ib0ada157825c844ff4b7b43efac9f27f3552f3d1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297775
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
This commit is contained in:
Mike Klein 2020-06-19 11:29:13 -05:00 committed by Skia Commit-Bot
parent 2a4871b80c
commit e81b10834e
21 changed files with 84 additions and 73 deletions

View File

@ -736,9 +736,8 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
paint.writable()->setDither(false);
}
SkMatrix ctm = matrixProvider.localToDevice();
if (gUseSkVMBlitter) {
if (auto blitter = SkCreateSkVMBlitter(device, *paint, ctm,
if (auto blitter = SkCreateSkVMBlitter(device, *paint, matrixProvider,
alloc, clipShader)) {
return blitter;
}
@ -751,13 +750,14 @@ SkBlitter* SkBlitter::Choose(const SkPixmap& device,
alloc, clipShader)) {
return blitter;
}
if (auto blitter = SkCreateSkVMBlitter(device, *paint, ctm,
if (auto blitter = SkCreateSkVMBlitter(device, *paint, matrixProvider,
alloc, clipShader)) {
return blitter;
}
return alloc->make<SkNullBlitter>();
};
SkMatrix ctm = matrixProvider.localToDevice();
// We'll end here for many interesting cases: color spaces, color filters, most color types.
if (UseRasterPipelineBlitter(device, *paint, ctm) || clipShader) {
return create_SkRP_or_SkVMBlitter();

View File

@ -177,7 +177,7 @@ SkBlitter* SkCreateRasterPipelineBlitter(const SkPixmap&, const SkPaint&,
SkBlitter* SkCreateSkVMBlitter(const SkPixmap&,
const SkPaint&,
const SkMatrix& ctm,
const SkMatrixProvider&,
SkArenaAlloc*,
sk_sp<SkShader> clipShader);

View File

@ -411,6 +411,7 @@ SkRuntimeEffect::ByteCodeResult SkRuntimeEffect::toByteCode(const void* inputs)
static std::vector<skvm::F32> program_fn(skvm::Builder* p,
const SkSL::ByteCodeFunction& fn,
const std::vector<skvm::F32>& uniform,
const SkMatrixProvider& matrices,
std::vector<skvm::F32> stack,
/*these parameters are used to call program() on children*/
const std::vector<sk_sp<SkShader>>& children,
@ -481,8 +482,9 @@ static std::vector<skvm::F32> program_fn(skvm::Builder* p,
skvm::F32 y = pop(),
x = pop();
SkOverrideDeviceMatrixProvider mats{matrices, SkMatrix::I()};
skvm::Color c = as_SB(children[ix])->program(p, x,y,paint,
SkMatrix::I(), nullptr,
mats, nullptr,
quality, dst,
uniforms, alloc);
if (!c) {
@ -798,7 +800,7 @@ public:
}
std::vector<skvm::F32> stack =
program_fn(p, *fn, uniform, {c.r, c.g, c.b, c.a},
program_fn(p, *fn, uniform, SkSimpleMatrixProvider{SkMatrix::I()}, {c.r, c.g, c.b, c.a},
/* the remaining parameters are for shaders only and won't be used here */
{},{},{},{},{},{},{},{});
@ -990,7 +992,7 @@ public:
}
skvm::Color onProgram(skvm::Builder* p, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider& matrices, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const override {
const SkSL::ByteCode* bc = this->byteCode();
@ -1003,11 +1005,7 @@ public:
return {};
}
// TODO: Eventually, plumb SkMatrixProvider here (instead of just ctm). For now, we will
// simply fail if our effect requires any marked matrices (SkSimpleMatrixProvider always
// returns false in getLocalToMarker).
SkSimpleMatrixProvider matrixProvider(SkMatrix::I());
sk_sp<SkData> inputs = this->getUniforms(matrixProvider, dst.colorSpace());
sk_sp<SkData> inputs = this->getUniforms(matrices, dst.colorSpace());
if (!inputs) {
return {};
}
@ -1020,13 +1018,13 @@ public:
}
SkMatrix inv;
if (!this->computeTotalInverse(ctm, localM, &inv)) {
if (!this->computeTotalInverse(matrices.localToDevice(), localM, &inv)) {
return {};
}
SkShaderBase::ApplyMatrix(p,inv, &x,&y,uniforms);
std::vector<skvm::F32> stack =
program_fn(p, *fn, uniform, {x,y, paint.r, paint.g, paint.b, paint.a},
program_fn(p, *fn, uniform, matrices, {x,y, paint.r, paint.g, paint.b, paint.a},
/*parameters for calling program() on children*/
fChildren, x,y,paint, quality,dst, uniforms,alloc);

View File

@ -34,13 +34,13 @@ namespace {
enum class Coverage { Full, UniformA8, MaskA8, MaskLCD16, Mask3D };
struct Params {
sk_sp<SkShader> shader;
sk_sp<SkShader> clip;
SkColorInfo dst;
SkBlendMode blendMode;
Coverage coverage;
SkFilterQuality quality;
SkMatrix ctm;
sk_sp<SkShader> shader;
sk_sp<SkShader> clip;
SkColorInfo dst;
SkBlendMode blendMode;
Coverage coverage;
SkFilterQuality quality;
const SkMatrixProvider& matrices;
Params withCoverage(Coverage c) const {
Params p = *this;
@ -59,7 +59,7 @@ namespace {
blendMode,
coverage;
uint32_t padding{0};
// Params::quality and Params::ctm are only passed to {shader,clip}->program(),
// Params::quality and Params::matrices are only passed to {shader,clip}->program(),
// not used here by the blitter itself. No need to include them in the key;
// they'll be folded into the shader key if used.
@ -130,7 +130,7 @@ namespace {
uint64_t hash = 0;
if (auto c = sb->program(&p,
x,y, paint,
params.ctm, /*localM=*/nullptr,
params.matrices, /*localM=*/nullptr,
params.quality, params.dst,
uniforms,alloc)) {
hash = p.hash();
@ -208,7 +208,7 @@ namespace {
};
skvm::Color src = as_SB(params.shader)->program(p, x,y, paint,
params.ctm, /*localM=*/nullptr,
params.matrices, /*localM=*/nullptr,
params.quality, params.dst,
uniforms, alloc);
SkASSERT(src);
@ -275,7 +275,7 @@ namespace {
if (params.clip) {
skvm::Color clip = as_SB(params.clip)->program(p, x,y, paint,
params.ctm, /*localM=*/nullptr,
params.matrices, /*localM=*/nullptr,
params.quality, params.dst,
uniforms, alloc);
SkAssertResult(clip);
@ -429,12 +429,12 @@ namespace {
bool isOpaque() const override { return fShader->isOpaque(); }
skvm::Color onProgram(skvm::Builder* p, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider& matrices, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const override {
// Run our wrapped shader.
skvm::Color c = as_SB(fShader)->program(p, x,y, paint,
ctm,localM, quality,dst, uniforms,alloc);
matrices,localM, quality,dst, uniforms,alloc);
if (!c) {
return {};
}
@ -501,7 +501,7 @@ namespace {
static Params effective_params(const SkPixmap& device,
const SkPaint& paint,
const SkMatrix& ctm,
const SkMatrixProvider& matrices,
sk_sp<SkShader> clip) {
// Color filters have been handled for us by SkBlitter::Choose().
SkASSERT(!paint.getColorFilter());
@ -547,7 +547,7 @@ namespace {
blendMode,
Coverage::Full, // Placeholder... withCoverage() will change as needed.
paint.getFilterQuality(),
ctm,
matrices,
};
}
@ -555,12 +555,12 @@ namespace {
public:
Blitter(const SkPixmap& device,
const SkPaint& paint,
const SkMatrix& ctm,
const SkMatrixProvider& matrices,
sk_sp<SkShader> clip,
bool* ok)
: fDevice(device)
, fUniforms(kBlitterUniformsCount)
, fParams(effective_params(device, paint, ctm, std::move(clip)))
, fParams(effective_params(device, paint, matrices, std::move(clip)))
, fKey(cache_key(fParams, &fUniforms, &fAlloc, ok))
, fPaint([&]{
SkColor4f color = paint.getColor4f();
@ -737,10 +737,10 @@ namespace {
SkBlitter* SkCreateSkVMBlitter(const SkPixmap& device,
const SkPaint& paint,
const SkMatrix& ctm,
const SkMatrixProvider& matrices,
SkArenaAlloc* alloc,
sk_sp<SkShader> clip) {
bool ok = true;
auto blitter = alloc->make<Blitter>(device, paint, ctm, std::move(clip), &ok);
auto blitter = alloc->make<Blitter>(device, paint, matrices, std::move(clip), &ok);
return ok ? blitter : nullptr;
}

View File

@ -63,11 +63,14 @@ bool SkColorFilterShader::onAppendStages(const SkStageRec& rec) const {
skvm::Color SkColorFilterShader::onProgram(skvm::Builder* p,
skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider& matrices, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const {
// Run the shader.
skvm::Color c = as_SB(fShader)->program(p, x,y, paint, ctm,localM, quality,dst, uniforms,alloc);
skvm::Color c = as_SB(fShader)->program(p, x,y, paint,
matrices,localM,
quality,dst,
uniforms,alloc);
if (!c) {
return {};
}

View File

@ -27,7 +27,7 @@ private:
bool onAppendStages(const SkStageRec&) const override;
skvm::Color onProgram(skvm::Builder*, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider&, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc*) const override;

View File

@ -93,7 +93,7 @@ bool SkColor4Shader::onAppendStages(const SkStageRec& rec) const {
skvm::Color SkColorShader::onProgram(skvm::Builder* p,
skvm::F32 /*x*/, skvm::F32 /*y*/, skvm::Color /*paint*/,
const SkMatrix& /*ctm*/, const SkMatrix* /*localM*/,
const SkMatrixProvider&, const SkMatrix* /*localM*/,
SkFilterQuality /*quality*/, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc*) const {
return p->uniformPremul(SkColor4f::FromColor(fColor), sk_srgb_singleton(),
@ -101,7 +101,7 @@ skvm::Color SkColorShader::onProgram(skvm::Builder* p,
}
skvm::Color SkColor4Shader::onProgram(skvm::Builder* p,
skvm::F32 /*x*/, skvm::F32 /*y*/, skvm::Color /*paint*/,
const SkMatrix& /*ctm*/, const SkMatrix* /*localM*/,
const SkMatrixProvider&, const SkMatrix* /*localM*/,
SkFilterQuality /*quality*/, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc*) const {
return p->uniformPremul(fColor, fColorSpace.get(),

View File

@ -45,7 +45,7 @@ private:
bool onAppendStages(const SkStageRec&) const override;
skvm::Color onProgram(skvm::Builder*, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider&, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc*) const override;
@ -70,7 +70,7 @@ private:
bool onAppendStages(const SkStageRec&) const override;
skvm::Color onProgram(skvm::Builder*, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider&, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc*) const override;

View File

@ -128,12 +128,12 @@ bool SkShader_Blend::onAppendStages(const SkStageRec& orig_rec) const {
}
skvm::Color SkShader_Blend::onProgram(skvm::Builder* p, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider& matrices, const SkMatrix* localM,
SkFilterQuality q, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const {
skvm::Color d,s;
if ((d = as_SB(fDst)->program(p, x,y, paint, ctm,localM, q, dst, uniforms, alloc)) &&
(s = as_SB(fSrc)->program(p, x,y, paint, ctm,localM, q, dst, uniforms, alloc)))
if ((d = as_SB(fDst)->program(p, x,y, paint, matrices,localM, q, dst, uniforms, alloc)) &&
(s = as_SB(fSrc)->program(p, x,y, paint, matrices,localM, q, dst, uniforms, alloc)))
{
return p->blend(fMode, s,d);
}
@ -168,12 +168,12 @@ bool SkShader_Lerp::onAppendStages(const SkStageRec& orig_rec) const {
}
skvm::Color SkShader_Lerp::onProgram(skvm::Builder* p, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider& matrices, const SkMatrix* localM,
SkFilterQuality q, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const {
skvm::Color d,s;
if ((d = as_SB(fDst)->program(p, x,y, paint, ctm,localM, q, dst, uniforms, alloc)) &&
(s = as_SB(fSrc)->program(p, x,y, paint, ctm,localM, q, dst, uniforms, alloc)))
if ((d = as_SB(fDst)->program(p, x,y, paint, matrices,localM, q, dst, uniforms, alloc)) &&
(s = as_SB(fSrc)->program(p, x,y, paint, matrices,localM, q, dst, uniforms, alloc)))
{
auto t = p->uniformF(uniforms->pushF(fWeight));
return {

View File

@ -28,7 +28,7 @@ protected:
void flatten(SkWriteBuffer&) const override;
bool onAppendStages(const SkStageRec&) const override;
skvm::Color onProgram(skvm::Builder*, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider&, const SkMatrix* localM,
SkFilterQuality, const SkColorInfo& dst,
skvm::Uniforms*, SkArenaAlloc*) const override;
@ -61,7 +61,7 @@ protected:
void flatten(SkWriteBuffer&) const override;
bool onAppendStages(const SkStageRec&) const override;
skvm::Color onProgram(skvm::Builder*, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider&, const SkMatrix* localM,
SkFilterQuality, const SkColorInfo& dst,
skvm::Uniforms*, SkArenaAlloc*) const override;

View File

@ -37,9 +37,10 @@ protected:
return false;
}
skvm::Color onProgram(skvm::Builder*, skvm::F32, skvm::F32, skvm::Color, const SkMatrix&,
const SkMatrix*, SkFilterQuality, const SkColorInfo&, skvm::Uniforms*,
SkArenaAlloc*) const override;
skvm::Color onProgram(skvm::Builder*, skvm::F32, skvm::F32, skvm::Color,
const SkMatrixProvider&, const SkMatrix*,
SkFilterQuality, const SkColorInfo&,
skvm::Uniforms*, SkArenaAlloc*) const override;
private:
SK_FLATTENABLE_HOOKS(SkEmptyShader)

View File

@ -640,13 +640,13 @@ SkStageUpdater* SkImageShader::onAppendUpdatableStages(const SkStageRec& rec) co
}
skvm::Color SkImageShader::onProgram(skvm::Builder* p, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider& matrices, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const {
quality = this->resolveFiltering(quality);
SkMatrix inv;
if (!this->computeTotalInverse(ctm, localM, &inv)) {
if (!this->computeTotalInverse(matrices.localToDevice(), localM, &inv)) {
return {};
}

View File

@ -59,7 +59,7 @@ private:
SkStageUpdater* onAppendUpdatableStages(const SkStageRec&) const override;
skvm::Color onProgram(skvm::Builder*, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider&, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc*) const override;

View File

@ -79,14 +79,17 @@ bool SkLocalMatrixShader::onAppendStages(const SkStageRec& rec) const {
skvm::Color SkLocalMatrixShader::onProgram(skvm::Builder* p,
skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider& matrices, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const {
SkTCopyOnFirstWrite<SkMatrix> lm(this->getLocalMatrix());
if (localM) {
lm.writable()->preConcat(*localM);
}
return as_SB(fProxyShader)->program(p, x,y, paint, ctm,lm.get(), quality,dst, uniforms,alloc);
return as_SB(fProxyShader)->program(p, x,y, paint,
matrices,lm.get(),
quality,dst,
uniforms,alloc);
}
sk_sp<SkShader> SkShader::makeWithLocalMatrix(const SkMatrix& localMatrix) const {
@ -154,10 +157,14 @@ protected:
}
skvm::Color onProgram(skvm::Builder* p, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider& matrices, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const override {
return as_SB(fProxyShader)->program(p, x,y,paint, fCTM,localM, quality,dst, uniforms,alloc);
SkOverrideDeviceMatrixProvider matrixProvider(matrices, fCTM);
return as_SB(fProxyShader)->program(p, x,y,paint,
matrixProvider,localM,
quality,dst,
uniforms,alloc);
}
private:

View File

@ -49,7 +49,7 @@ protected:
bool onAppendStages(const SkStageRec&) const override;
skvm::Color onProgram(skvm::Builder*, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider&, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc*) const override;

View File

@ -276,19 +276,20 @@ bool SkPictureShader::onAppendStages(const SkStageRec& rec) const {
skvm::Color SkPictureShader::onProgram(skvm::Builder* p,
skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider& matrices, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const {
auto lm = this->totalLocalMatrix(localM);
// Keep bitmapShader alive by using alloc instead of stack memory
auto& bitmapShader = *alloc->make<sk_sp<SkShader>>();
bitmapShader = this->refBitmapShader(ctm, &lm, dst.colorType(), dst.colorSpace());
bitmapShader = this->refBitmapShader(matrices.localToDevice(), &lm,
dst.colorType(), dst.colorSpace());
if (!bitmapShader) {
return {};
}
return as_SB(bitmapShader)->program(p, x,y, paint, ctm, lm, quality, dst, uniforms, alloc);
return as_SB(bitmapShader)->program(p, x,y, paint, matrices, lm, quality, dst, uniforms, alloc);
}
/////////////////////////////////////////////////////////////////////////////////////////

View File

@ -38,7 +38,7 @@ protected:
void flatten(SkWriteBuffer&) const override;
bool onAppendStages(const SkStageRec&) const override;
skvm::Color onProgram(skvm::Builder*, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider&, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const override;

View File

@ -196,7 +196,7 @@ bool SkShaderBase::onAppendStages(const SkStageRec& rec) const {
}
skvm::Color SkShaderBase::program(skvm::Builder* p, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider& matrices, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const {
// Force opaque alpha for all opaque shaders.
@ -211,7 +211,7 @@ skvm::Color SkShaderBase::program(skvm::Builder* p, skvm::F32 x, skvm::F32 y, sk
// shader program hash and blitter Key. This makes it safe for us to use
// that bit to make decisions when constructing an SkVMBlitter, like doing
// SrcOver -> Src strength reduction.
if (auto color = this->onProgram(p, x,y, paint, ctm,localM, quality,dst, uniforms,alloc)) {
if (auto color = this->onProgram(p, x,y, paint, matrices,localM, quality,dst, uniforms,alloc)) {
if (this->isOpaque()) {
color.a = p->splat(1.0f);
}
@ -221,7 +221,7 @@ skvm::Color SkShaderBase::program(skvm::Builder* p, skvm::F32 x, skvm::F32 y, sk
}
skvm::Color SkShaderBase::onProgram(skvm::Builder*, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider&, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const {
//SkDebugf("cannot onProgram %s\n", this->getTypeName());
@ -262,8 +262,9 @@ void SkShaderBase::ApplyMatrix(skvm::Builder* p, const SkMatrix& m,
///////////////////////////////////////////////////////////////////////////////////////////////////
skvm::Color SkEmptyShader::onProgram(skvm::Builder*, skvm::F32, skvm::F32, skvm::Color,
const SkMatrix&, const SkMatrix*, SkFilterQuality,
const SkColorInfo&, skvm::Uniforms*, SkArenaAlloc*) const {
const SkMatrixProvider&, const SkMatrix*,
SkFilterQuality, const SkColorInfo&,
skvm::Uniforms*, SkArenaAlloc*) const {
return {}; // signal failure
}

View File

@ -212,7 +212,7 @@ public:
}
skvm::Color program(skvm::Builder*, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider&, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const;
@ -248,7 +248,7 @@ private:
SkMatrix fLocalMatrix;
virtual skvm::Color onProgram(skvm::Builder*, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider&, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dst,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const;

View File

@ -421,11 +421,11 @@ bool SkGradientShaderBase::onAppendStages(const SkStageRec& rec) const {
skvm::Color SkGradientShaderBase::onProgram(skvm::Builder* p,
skvm::F32 x, skvm::F32 y, skvm::Color /*paint*/,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider& mats, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dstInfo,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const {
SkMatrix inv;
if (!this->computeTotalInverse(ctm, localM, &inv)) {
if (!this->computeTotalInverse(mats.localToDevice(), localM, &inv)) {
return {};
}
inv.postConcat(fPtsToUnit);

View File

@ -80,7 +80,7 @@ protected:
bool onAppendStages(const SkStageRec&) const override;
skvm::Color onProgram(skvm::Builder* p, skvm::F32 x, skvm::F32 y, skvm::Color paint,
const SkMatrix& ctm, const SkMatrix* localM,
const SkMatrixProvider&, const SkMatrix* localM,
SkFilterQuality quality, const SkColorInfo& dstCS,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const override;