From 3b840e930493d260bf4945af03920c01400ee6cc Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Tue, 23 May 2017 15:06:17 -0400 Subject: add a bulk shader path through SkRasterPipelineBlitter Change-Id: I76f1f0c29b3408bffb7732ee1afb8337c478605e Reviewed-on: https://skia-review.googlesource.com/17768 Commit-Queue: Mike Klein Reviewed-by: Florin Malita Reviewed-by: Herb Derby --- src/core/SkShader.cpp | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) (limited to 'src/core/SkShader.cpp') diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp index c8d5f08776..ff5b400a25 100644 --- a/src/core/SkShader.cpp +++ b/src/core/SkShader.cpp @@ -264,42 +264,7 @@ bool SkShader::appendStages(SkRasterPipeline* p, const SkMatrix& ctm, const SkPaint& paint, const SkMatrix* localM) const { - SkRasterPipeline_<256> subclass; - if (this->onAppendStages(&subclass, dstCS, alloc, ctm, paint, localM)) { - p->extend(subclass); - return true; - } - - // SkShader::Context::shadeSpan4f() handles the paint opacity internally, - // but SkRasterPipelineBlitter applies it as a separate stage. - // We skip the internal shadeSpan4f() step by forcing the paint opaque. - SkTCopyOnFirstWrite opaquePaint(paint); - if (paint.getAlpha() != SK_AlphaOPAQUE) { - opaquePaint.writable()->setAlpha(SK_AlphaOPAQUE); - } - - ContextRec rec(*opaquePaint, ctm, localM, ContextRec::kPM4f_DstType, dstCS); - - struct CallbackCtx : SkJumper_CallbackCtx { - sk_sp shader; - Context* ctx; - }; - auto cb = alloc->make(); - cb->shader = dstCS ? SkColorSpaceXformer::Make(sk_ref_sp(dstCS))->apply(this) - : sk_ref_sp(const_cast(this)); - cb->ctx = cb->shader->makeContext(rec, alloc); - cb->fn = [](SkJumper_CallbackCtx* self, int active_pixels) { - auto c = (CallbackCtx*)self; - int x = (int)c->rgba[0], - y = (int)c->rgba[1]; - c->ctx->shadeSpan4f(x,y, (SkPM4f*)c->rgba, active_pixels); - }; - - if (cb->ctx) { - p->append(SkRasterPipeline::callback, cb); - return true; - } - return false; + return this->onAppendStages(p, dstCS, alloc, ctm, paint, localM); } bool SkShader::onAppendStages(SkRasterPipeline* p, -- cgit v1.2.3