Fix color gamut xform matrices in GPU code

Now that we're not storing them transposed, we can plumb them to the
shader column-major all the way, and then multiply colors on the right, as
it should be.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2326093002

Review-Url: https://codereview.chromium.org/2326093002
This commit is contained in:
brianosman 2016-09-09 11:30:55 -07:00 committed by Commit bot
parent b37c034ac8
commit 8d914908d8
2 changed files with 2 additions and 3 deletions

View File

@ -37,8 +37,7 @@ static inline bool matrix_is_almost_identity(const SkMatrix44& m,
GrColorSpaceXform::GrColorSpaceXform(const SkMatrix44& srcToDst, SkAlphaType srcAlphaType)
: fSrcAlphaType(srcAlphaType) {
// TODO: Fix this, and store things as column major!
srcToDst.asRowMajorf(fSrcToDst);
srcToDst.asColMajorf(fSrcToDst);
}
sk_sp<GrColorSpaceXform> GrColorSpaceXform::Make(SkColorSpace* src, SkColorSpace* dst,

View File

@ -149,7 +149,7 @@ void GrGLSLShaderBuilder::appendColorGamutXform(SkString* out,
"\tcolor.rgb = color.rgb / nonZeroAlpha;\n");
}
// Gamut xform, clamp to destination gamut
functionBody.append("\tcolor.rgb = clamp((vec4(color.rgb, 1.0) * xform).rgb, 0.0, 1.0);\n");
functionBody.append("\tcolor.rgb = clamp((xform * vec4(color.rgb, 1.0)).rgb, 0.0, 1.0);\n");
if (kPremul_SkAlphaType == colorXformHelper->alphaType()) {
// Re-multiply by alpha
functionBody.append("\tcolor.rgb = color.rgb * nonZeroAlpha;\n");