diff options
author | Mike Klein <mtklein@chromium.org> | 2018-07-11 14:49:51 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-11 20:14:38 +0000 |
commit | 4eebd9eed06039d265f06edb759765731f963271 (patch) | |
tree | a60d5bf110250ad75593977b39fdf93a019c1fff /src/opts | |
parent | c0a27081722eaebd005cf9c2eb78d7d1e4db7e2c (diff) |
collapse parametric_{r,g,b} into parametric, remove _a and gamma_dst
parametric_a and gamma_dst were unused outside of unit tests.
In all other cases, we always use parametric_{r,g,b} together
and always pass them the same argument. So we can collapse
them into a single stage like gamma and to/from_srgb.
Change-Id: I08cea896c7744f97b4f4bf9e029f5d643e45e177
Reviewed-on: https://skia-review.googlesource.com/140576
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/opts')
-rw-r--r-- | src/opts/SkRasterPipeline_opts.h | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/opts/SkRasterPipeline_opts.h b/src/opts/SkRasterPipeline_opts.h index 1266970285..0dce9cfdb6 100644 --- a/src/opts/SkRasterPipeline_opts.h +++ b/src/opts/SkRasterPipeline_opts.h @@ -1483,26 +1483,24 @@ STAGE(byte_tables, const void* ctx) { // TODO: rename Tables SkJumper_ByteTable a = from_byte(gather(tables->a, to_unorm(a, 255))); } -SI F parametric(F v, const SkJumper_ParametricTransferFunction* ctx) { - F r = if_then_else(v <= ctx->D, mad(ctx->C, v, ctx->F) - , approx_powf(mad(ctx->A, v, ctx->B), ctx->G) + ctx->E); - return min(max(r, 0), 1.0f); // Clamp to [0,1], with argument order mattering to handle NaN. +STAGE(parametric, const SkJumper_ParametricTransferFunction* ctx) { + auto fn = [&](F v) { + F r = if_then_else(v <= ctx->D, mad(ctx->C, v, ctx->F) + , approx_powf(mad(ctx->A, v, ctx->B), ctx->G) + ctx->E); + // Clamp to [0,1], with argument order mattering to handle NaN. + // TODO: should we really be clamping here? + return min(max(r, 0), 1.0f); + }; + r = fn(r); + g = fn(g); + b = fn(b); } -STAGE(parametric_r, const SkJumper_ParametricTransferFunction* ctx) { r = parametric(r, ctx); } -STAGE(parametric_g, const SkJumper_ParametricTransferFunction* ctx) { g = parametric(g, ctx); } -STAGE(parametric_b, const SkJumper_ParametricTransferFunction* ctx) { b = parametric(b, ctx); } -STAGE(parametric_a, const SkJumper_ParametricTransferFunction* ctx) { a = parametric(a, ctx); } STAGE(gamma, const float* G) { r = approx_powf(r, *G); g = approx_powf(g, *G); b = approx_powf(b, *G); } -STAGE(gamma_dst, const float* G) { - dr = approx_powf(dr, *G); - dg = approx_powf(dg, *G); - db = approx_powf(db, *G); -} STAGE(load_a8, const SkJumper_MemoryCtx* ctx) { auto ptr = ptr_at_xy<const uint8_t>(ctx, dx,dy); @@ -3220,8 +3218,7 @@ static NotImplemented byte_tables, colorburn, colordodge, softlight, hue, saturation, color, luminosity, matrix_3x3, matrix_3x4, matrix_4x5, matrix_4x3, - parametric_r, parametric_g, parametric_b, parametric_a, - gamma, gamma_dst, + parametric, gamma, rgb_to_hsl, hsl_to_rgb, gauss_a_to_rgba, mirror_x, repeat_x, |