Fix GPU colormatrix color filter with saturated alpha.

Clamp RGBA values before unpremultiplying, to match the raster path. This causes a problem when the resulting
alpha is >1.0, resulting in overly saturated RGB.

Covered by the setYUV2RGB() test case in the colormatrix GM.

R=bsalomon@google.com

Review URL: https://codereview.chromium.org/196133006

git-svn-id: http://skia.googlecode.com/svn/trunk@13778 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
senorblanco@chromium.org 2014-03-12 21:37:42 +00:00
parent 641e33b3f6
commit 2ca677e75d
2 changed files with 6 additions and 0 deletions

View File

@ -51,3 +51,8 @@ rrect_clip_aa
# This change removes an API that this GM was testing. If/when it lands and sticks,
# I will likely just delete the GM.
canvas-layer-state
# senorblanco: https://codereview.chromium.org/196133006/
# The setYUV2RGB sample in transparent mode in this GM this test has always
# drawn incorrectly on the GPU. The change above fixes it.
colormatrix

View File

@ -424,6 +424,7 @@ public:
builder->getUniformCStr(fMatrixHandle),
inputColor,
builder->getUniformCStr(fVectorHandle));
builder->fsCodeAppendf("\t%s = clamp(%s, 0.0, 1.0);\n", outputColor, outputColor);
builder->fsCodeAppendf("\t%s.rgb *= %s.a;\n", outputColor, outputColor);
}