aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/shaders/SkComposeShader.cpp
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-08-29 14:58:19 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-29 20:10:31 +0000
commit1d8c42eb903b66035ecf4d45b03dfeb1ad07b957 (patch)
treebddb7925865421ff762ae7e458ae3c24b6be477e /src/shaders/SkComposeShader.cpp
parent8b0f265f70703fa96c6d9011b1d8440e60d63632 (diff)
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>
Diffstat (limited to 'src/shaders/SkComposeShader.cpp')
-rw-r--r--src/shaders/SkComposeShader.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/shaders/SkComposeShader.cpp b/src/shaders/SkComposeShader.cpp
index 9799a1c142..0bc8c8c7cf 100644
--- a/src/shaders/SkComposeShader.cpp
+++ b/src/shaders/SkComposeShader.cpp
@@ -84,36 +84,34 @@ bool SkComposeShader::asACompose(ComposeRec* rec) const {
}
#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;
}