diff options
author | Mike Klein <mtklein@google.com> | 2018-07-10 15:52:06 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-10 20:08:50 +0000 |
commit | 6eb36214461794626291a01c3150f7239e4a91a3 (patch) | |
tree | fb1165266f576b6c3006be5f207a675c412155db /src/core/SkRasterPipeline.cpp | |
parent | 5d948228d91ae8ff2c9602ff45a9e8661665ed46 (diff) |
transform paint color to dst colorspace
Hopefully I can start to knock off effects that need
to be converted to dst colorspace one at a time now.
My rough list is,
- paint color <----
- image shader
- sprite blitter
- gradients?
- mode color filter
- lighting color filter
- high contrast filter
- toSRGB color filter
This change cuts the diffs between 8888 and srgb from
~540 to ~500.
I left myself a note about not being able to interpret null
to sRGB at a high level yet. That'd cause a ton of 8888 diffs,
and I think SkColorSpaceXformCanvas diffs too.
Change-Id: Id66a63e0e92130927f267719aeccb8bbcd92973a
Reviewed-on: https://skia-review.googlesource.com/140244
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Diffstat (limited to 'src/core/SkRasterPipeline.cpp')
-rw-r--r-- | src/core/SkRasterPipeline.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/SkRasterPipeline.cpp b/src/core/SkRasterPipeline.cpp index 46658969cd..5125476dde 100644 --- a/src/core/SkRasterPipeline.cpp +++ b/src/core/SkRasterPipeline.cpp @@ -90,9 +90,7 @@ void SkRasterPipeline::dump() const { #endif void SkRasterPipeline::append_constant_color(SkArenaAlloc* alloc, const float rgba[4]) { - SkASSERT(0 <= rgba[0] && rgba[0] <= 1); - SkASSERT(0 <= rgba[1] && rgba[1] <= 1); - SkASSERT(0 <= rgba[2] && rgba[2] <= 1); + // r,g,b might be outside [0,1], but alpha should probably always be in [0,1]. SkASSERT(0 <= rgba[3] && rgba[3] <= 1); if (rgba[0] == 0 && rgba[1] == 0 && rgba[2] == 0 && rgba[3] == 1) { @@ -106,6 +104,10 @@ void SkRasterPipeline::append_constant_color(SkArenaAlloc* alloc, const float rg Sk4f color = Sk4f::Load(rgba); color.store(&ctx->r); + // TODO: if any channel is out of [0,1], append a float-only stage + // that can handle that, instead of this uniform_color that assumes + // in-range values so it can work in lowp. + // To make loads more direct, we store 8-bit values in 16-bit slots. color = color * 255.0f + 0.5f; ctx->rgba[0] = (uint16_t)color[0]; |