aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opts
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-04-20 16:21:57 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-04-21 16:00:06 +0000
commitc17dc24fa9994eacc640d3adc6633a02fd96d3fc (patch)
tree936817a3e67e0a748cf36e39f58878ff02d6cb5a /src/opts
parent8f7dc9f6caabe798723d9f17aff371121369b846 (diff)
jumper, rework callback a bit, use it for color_lookup_table
Looks like the color-space images have this well tested (even without lab_to_xyz) and the diffs look like rounding/FMA. The old plan to keep loads and stores outside callback was: 1) awkward, with too many pointers and pointers to pointers to track 2) misguided... load and store stages march ahead by x, working at ptr+0, ptr+8, ptr+16, etc. while callback always wants to be working at the same spot in the buffer. I spent a frustrating day in lldb to understood 2). :/ So now the stage always store4's its pixels to a buffer in the context before the callback, and when the callback returns it load4's them back from a pointer in the context, defaulting to that same buffer. Instead of passing a void* into the callback, we pass the context itself. This lets us subclass the context and add our own data... C-compatible object-oriented programming. Change-Id: I7a03439b3abd2efb000a6973631a9336452e9a43 Reviewed-on: https://skia-review.googlesource.com/13985 Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/opts')
-rw-r--r--src/opts/SkRasterPipeline_opts.h30
1 files changed, 4 insertions, 26 deletions
diff --git a/src/opts/SkRasterPipeline_opts.h b/src/opts/SkRasterPipeline_opts.h
index b15ebf36d8..2b5b2e56c1 100644
--- a/src/opts/SkRasterPipeline_opts.h
+++ b/src/opts/SkRasterPipeline_opts.h
@@ -9,7 +9,6 @@
#define SkRasterPipeline_opts_DEFINED
#include "SkColorPriv.h"
-#include "SkColorLookUpTable.h"
#include "SkColorSpaceXform_A2B.h"
#include "SkColorSpaceXformPriv.h"
#include "SkHalf.h"
@@ -796,29 +795,6 @@ STAGE_CTX(table_g, const SkTableTransferFn*) { g = table(g, *ctx); }
STAGE_CTX(table_b, const SkTableTransferFn*) { b = table(b, *ctx); }
STAGE_CTX(table_a, const SkTableTransferFn*) { a = table(a, *ctx); }
-STAGE_CTX(color_lookup_table, const SkColorLookUpTable*) {
- const SkColorLookUpTable* colorLUT = ctx;
- SkASSERT(3 == colorLUT->inputChannels() || 4 == colorLUT->inputChannels());
- SkASSERT(3 == colorLUT->outputChannels());
- float result[3][N];
- for (int i = 0; i < N; ++i) {
- const float in[4] = { r[i], g[i], b[i], a[i] };
- float out[3];
- colorLUT->interp(out, in);
- for (int j = 0; j < colorLUT->outputChannels(); ++j) {
- result[j][i] = out[j];
- }
- }
- r = SkNf::Load(result[0]);
- g = SkNf::Load(result[1]);
- b = SkNf::Load(result[2]);
- if (4 == colorLUT->inputChannels()) {
- // we must set the pixel to opaque, as the alpha channel was used
- // as input before this.
- a = 1.f;
- }
-}
-
STAGE(lab_to_xyz) {
const auto lab_l = r * 100.0f;
const auto lab_a = g * 255.0f - 128.0f;
@@ -1099,8 +1075,10 @@ STAGE_CTX(shader_adapter, SkShader::Context*) {
}
STAGE_CTX(callback, const void*) {
- auto c = (const SkJumper_CallbackCtx*)ctx;
- c->fn(c->arg, tail ? tail : N);
+ auto c = (SkJumper_CallbackCtx*)ctx;
+ SkNf::Store4(c->rgba, r,g,b,a);
+ c->fn(c, tail ? tail : N);
+ SkNf::Load4(c->read_from, &r,&g,&b,&a);
}
SI Fn enum_to_Fn(SkRasterPipeline::StockStage st) {