Clamp premul colors correctly after a gamut change
authorBrian Osman <brianosman@google.com>
Wed, 4 Jan 2017 17:54:07 +0000 (12:54 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Wed, 4 Jan 2017 18:28:26 +0000 (18:28 +0000)
commit0bd783f951a004ccca175b166f2b30a0fd18a6f6
tree3d0188619d3b4524e506e3a174ebbb61650db682
parente151bdb357c21b833718b369fe8fbd7fd57ae474
Clamp premul colors correctly after a gamut change

Textures that we sample on the GPU are always premul, so we should
actually clamp to alpha.

Colors that are xformed on the CPU are always unpremul, so clamping to
[0,1] is correct. Add a comment explaining that.

BUG=skia:

Change-Id: I180f2d410f24afc78bd03ab8636a83fb443d68e2
Reviewed-on: https://skia-review.googlesource.com/6581
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
src/gpu/GrColorSpaceXform.cpp
src/gpu/glsl/GrGLSLShaderBuilder.cpp