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:
parent
b37c034ac8
commit
8d914908d8
@ -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,
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user