fold params into StageRec
pre-CL before trying to add a hint-rect field to allow shaders to "optimize"
their stages for a given restriction in device space
- e.g. if the shader's intrinsic domain is contained, it won't need to tile/clamp
Bug: skia:
Change-Id: Ia2da557691da25f31e4b9e3f53c3bc6709b89083
Reviewed-on: https://skia-review.googlesource.com/40224
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/src/shaders/SkComposeShader.cpp b/src/shaders/SkComposeShader.cpp
index 9799a1c..0bc8c8c 100644
--- a/src/shaders/SkComposeShader.cpp
+++ b/src/shaders/SkComposeShader.cpp
@@ -84,36 +84,34 @@
}
#endif
-bool SkComposeShader::onAppendStages(SkRasterPipeline* pipeline, SkColorSpace* dstCS,
- SkArenaAlloc* alloc, const SkMatrix& ctm,
- const SkPaint& paint, const SkMatrix* localM) const {
+bool SkComposeShader::onAppendStages(const StageRec& rec) const {
struct Storage {
float fRGBA[4 * SkJumper_kMaxStride];
float fAlpha;
};
- auto storage = alloc->make<Storage>();
+ auto storage = rec.fAlloc->make<Storage>();
- if (!as_SB(fSrc)->appendStages(pipeline, dstCS, alloc, ctm, paint, localM)) {
+ if (!as_SB(fSrc)->appendStages(rec)) {
return false;
}
// This outputs r,g,b,a, which we'll need later when we apply the mode, but we save it off now
// since fShaderB will overwrite them.
- pipeline->append(SkRasterPipeline::store_rgba, storage->fRGBA);
+ rec.fPipeline->append(SkRasterPipeline::store_rgba, storage->fRGBA);
- if (!as_SB(fDst)->appendStages(pipeline, dstCS, alloc, ctm, paint, localM)) {
+ if (!as_SB(fDst)->appendStages(rec)) {
return false;
}
// We now have our logical 'dst' in r,g,b,a, but we need it in dr,dg,db,da for the mode/lerp
// so we have to shuttle them. If we had a stage the would load_into_dst, then we could
// reverse the two shader invocations, and avoid this move...
- pipeline->append(SkRasterPipeline::move_src_dst);
- pipeline->append(SkRasterPipeline::load_rgba, storage->fRGBA);
+ rec.fPipeline->append(SkRasterPipeline::move_src_dst);
+ rec.fPipeline->append(SkRasterPipeline::load_rgba, storage->fRGBA);
if (!this->isJustLerp()) {
- SkBlendMode_AppendStages(fMode, pipeline);
+ SkBlendMode_AppendStages(fMode, rec.fPipeline);
}
if (!this->isJustMode()) {
- pipeline->append(SkRasterPipeline::lerp_1_float, &fLerpT);
+ rec.fPipeline->append(SkRasterPipeline::lerp_1_float, &fLerpT);
}
return true;
}