aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opts/SkRasterPipeline_opts.h
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2017-01-30 12:08:05 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-31 14:14:13 +0000
commit9206c76337cd349c769103e06af005edd0583a10 (patch)
treeecaa3b8f3e3039bee723749ef18853d09087a0b5 /src/opts/SkRasterPipeline_opts.h
parentac95c5fc93bfdf22999f9c9e1f0f1e18fea686cf (diff)
SkRasterPipeline shader adapter
Reland of https://skia-review.googlesource.com/c/7615. (lifted from https://skia-review.googlesource.com/c/7088/) CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: I797a2f0ae80209c8637875418e08d2fa03249672 Reviewed-on: https://skia-review.googlesource.com/7731 Commit-Queue: Florin Malita <fmalita@google.com> Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'src/opts/SkRasterPipeline_opts.h')
-rw-r--r--src/opts/SkRasterPipeline_opts.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/opts/SkRasterPipeline_opts.h b/src/opts/SkRasterPipeline_opts.h
index 1b27fc25d4..dec81d990a 100644
--- a/src/opts/SkRasterPipeline_opts.h
+++ b/src/opts/SkRasterPipeline_opts.h
@@ -18,6 +18,7 @@
#include "SkPM4f.h"
#include "SkPM4fPriv.h"
#include "SkRasterPipeline.h"
+#include "SkShader.h"
#include "SkSRGB.h"
namespace {
@@ -1085,6 +1086,13 @@ STAGE_CTX(byte_tables, const void*) {
a = SkNf_from_byte(gather(tail, tables->a, SkNf_round(255.0f, a)));
}
+STAGE_CTX(shader_adapter, SkShader::Context*) {
+ SkPM4f buf[N];
+ static_assert(sizeof(buf) == sizeof(r) + sizeof(g) + sizeof(b) + sizeof(a), "");
+ ctx->shadeSpan4f(x, (int)g[0], buf, N);
+ SkNf::Load4(buf, &r, &g, &b, &a);
+}
+
SI Fn enum_to_Fn(SkRasterPipeline::StockStage st) {
switch (st) {
#define M(stage) case SkRasterPipeline::stage: return stage;