aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opts
diff options
context:
space:
mode:
authorGravatar Matt Sarett <msarett@google.com>2017-02-22 13:02:31 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-22 18:51:33 +0000
commite522f4c455d0d5dbe813f38d16c0d4cd46fa5dee (patch)
treee0be77c59c8b06ac3b284104ab946613f2b6bdd7 /src/opts
parent416bbd97cee9e221577c729a8072fdb2057cbdf8 (diff)
Enable legacy premuls in SkColorSpaceXform
***Will allow for simplified Android framework code, they typically want a color correct transform followed by a gamma encoded premul. ***Chrome does the same, so this will make it easier to replace their codecs. ***Will decrease code size. Both types of premuls are moved off the fast path here - one is essentially unused in production and the other is not "encouraged". ***Will actually make the common case faster: sRGB->sRGB means no color xform, just premul in SkSwizzler. BUG=skia: CQ_INCLUDE_TRYBOTS=skia.primary:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD Change-Id: Ia4ec1d273b6f137151f951d37c0ebf975f6b9a3e Reviewed-on: https://skia-review.googlesource.com/8848 Reviewed-by: Mike Klein <mtklein@chromium.org> Commit-Queue: Matt Sarett <msarett@google.com>
Diffstat (limited to 'src/opts')
-rw-r--r--src/opts/SkRasterPipeline_opts.h24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/opts/SkRasterPipeline_opts.h b/src/opts/SkRasterPipeline_opts.h
index 0a7441b304..07f1e5ab1c 100644
--- a/src/opts/SkRasterPipeline_opts.h
+++ b/src/opts/SkRasterPipeline_opts.h
@@ -704,20 +704,6 @@ STAGE_CTX(load_tables_rgb_u16_be, const LoadTablesContext*) {
a = 1.0f;
}
-STAGE_CTX(store_tables, const StoreTablesContext*) {
- auto ptr = ctx->fDst + x;
-
- float scale = ctx->fCount - 1;
- SkNi ri = SkNf_round(scale, r);
- SkNi gi = SkNf_round(scale, g);
- SkNi bi = SkNf_round(scale, b);
-
- store(tail, ( SkNx_cast<int>(gather(tail, ctx->fR, ri)) << 0
- | SkNx_cast<int>(gather(tail, ctx->fG, gi)) << 8
- | SkNx_cast<int>(gather(tail, ctx->fB, bi)) << 16
- | SkNf_round(255.0f, a) << 24), (int*)ptr);
-}
-
SI SkNf inv(const SkNf& x) { return 1.0f - x; }
RGBA_XFERMODE(clear) { return 0.0f; }
@@ -1145,6 +1131,16 @@ STAGE_CTX(byte_tables, const void*) {
a = SkNf_from_byte(gather(tail, tables->a, SkNf_round(255.0f, a)));
}
+STAGE_CTX(byte_tables_rgb, const void*) {
+ struct Tables { const uint8_t *r, *g, *b; int n; };
+ auto tables = (const Tables*)ctx;
+
+ float scale = tables->n - 1;
+ r = SkNf_from_byte(gather(tail, tables->r, SkNf_round(scale, r)));
+ g = SkNf_from_byte(gather(tail, tables->g, SkNf_round(scale, g)));
+ b = SkNf_from_byte(gather(tail, tables->b, SkNf_round(scale, b)));
+}
+
STAGE_CTX(shader_adapter, SkShader::Context*) {
SkPM4f buf[N];
static_assert(sizeof(buf) == sizeof(r) + sizeof(g) + sizeof(b) + sizeof(a), "");