aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/jumper/SkJumper_stages.cpp
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-04-06 15:04:05 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-06 20:22:41 +0000
commitdec4ea81ce38614426b9a0f1245fa90d883ddb52 (patch)
tree43d9f9566afb90ae8df9979712cd7d6eff6e1074 /src/jumper/SkJumper_stages.cpp
parentd7cda9a6f050c30e65b0744b3cfb45cecdc40834 (diff)
jumper, gather_8888
Change-Id: I70bd64d114a2460534bcb51d356e13d9bc3b8603 Reviewed-on: https://skia-review.googlesource.com/11491 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/jumper/SkJumper_stages.cpp')
-rw-r--r--src/jumper/SkJumper_stages.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/jumper/SkJumper_stages.cpp b/src/jumper/SkJumper_stages.cpp
index 6e0c908593..2bdcf8724a 100644
--- a/src/jumper/SkJumper_stages.cpp
+++ b/src/jumper/SkJumper_stages.cpp
@@ -268,6 +268,18 @@ SI void from_4444(U16 _4444, F* r, F* g, F* b, F* a) {
*b = cast(wide & C(15<< 4)) * C(1.0f / (15<< 4));
*a = cast(wide & C(15<< 0)) * C(1.0f / (15<< 0));
}
+SI void from_8888(U32 _8888, F* r, F* g, F* b, F* a) {
+ *r = cast((_8888 ) & 0xff_i) * C(1/255.0f);
+ *g = cast((_8888 >> 8) & 0xff_i) * C(1/255.0f);
+ *b = cast((_8888 >> 16) & 0xff_i) * C(1/255.0f);
+ *a = cast((_8888 >> 24) ) * C(1/255.0f);
+}
+
+template <typename T>
+SI U32 ix_and_ptr(T** ptr, const GatherCtx* ctx, F x, F y) {
+ *ptr = (const T*)ctx->pixels;
+ return trunc_(y)*ctx->stride + trunc_(x);
+}
// Now finally, normal Stages!
@@ -616,12 +628,12 @@ STAGE(store_4444) {
STAGE(load_8888) {
auto ptr = *(const uint32_t**)ctx + x;
-
- auto px = load<U32>(ptr, tail);
- r = cast((px ) & 0xff_i) * C(1/255.0f);
- g = cast((px >> 8) & 0xff_i) * C(1/255.0f);
- b = cast((px >> 16) & 0xff_i) * C(1/255.0f);
- a = cast((px >> 24) ) * C(1/255.0f);
+ from_8888(load<U32>(ptr, tail), &r,&g,&b,&a);
+}
+STAGE(gather_8888) {
+ const uint32_t* ptr;
+ U32 ix = ix_and_ptr(&ptr, ctx, r,g);
+ from_8888(gather(ptr, ix), &r,&g,&b,&a);
}
STAGE(store_8888) {
auto ptr = *(uint32_t**)ctx + x;