From e522f4c455d0d5dbe813f38d16c0d4cd46fa5dee Mon Sep 17 00:00:00 2001 From: Matt Sarett Date: Wed, 22 Feb 2017 13:02:31 -0500 Subject: 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 Commit-Queue: Matt Sarett --- src/opts/SkRasterPipeline_opts.h | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src/opts') 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(gather(tail, ctx->fR, ri)) << 0 - | SkNx_cast(gather(tail, ctx->fG, gi)) << 8 - | SkNx_cast(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), ""); -- cgit v1.2.3