diff options
author | 2016-09-07 08:09:10 -0700 | |
---|---|---|
committer | 2016-09-07 08:09:10 -0700 | |
commit | 77320dbabcddf05c0a1489eaf1f496729dc8de0e (patch) | |
tree | 6dce3ee85d2206685279217db47e66dd47839e43 /src/gpu/effects/GrBicubicEffect.cpp | |
parent | d2e39dbc6a68a6cc2a480d0c8082eb204f6b6e77 (diff) |
Add color gamut xform helpers to GrGLSLShaderBuilder
New helper functions inject the necessary shader
function. Texture lookup functions can now insert
the gamut xform at the appropriate place, too.
As written, could be used to transform non-texture
colors (e.g. vertex colors) as well.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2180803005
Review-Url: https://codereview.chromium.org/2180803005
Diffstat (limited to 'src/gpu/effects/GrBicubicEffect.cpp')
-rw-r--r-- | src/gpu/effects/GrBicubicEffect.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp index 8439909f56..69fe906471 100644 --- a/src/gpu/effects/GrBicubicEffect.cpp +++ b/src/gpu/effects/GrBicubicEffect.cpp @@ -30,7 +30,7 @@ public: GrProcessorKeyBuilder* b) { const GrBicubicEffect& bicubicEffect = effect.cast<GrBicubicEffect>(); b->add32(GrTextureDomain::GLDomain::DomainKey(bicubicEffect.domain())); - b->add32(SkToInt(SkToBool(bicubicEffect.colorSpaceXform()))); + b->add32(GrColorSpaceXform::XformKey(bicubicEffect.colorSpaceXform())); } protected: @@ -114,7 +114,9 @@ void GrGLBicubicEffect::emitCode(EmitArgs& args) { SkString bicubicColor; bicubicColor.printf("%s(%s, f.y, s0, s1, s2, s3)", cubicBlendName.c_str(), coeff); if (colorSpaceHelper.getXformMatrix()) { - bicubicColor.appendf(" * %s", colorSpaceHelper.getXformMatrix()); + SkString xformedColor; + fragBuilder->appendColorGamutXform(&xformedColor, bicubicColor.c_str(), &colorSpaceHelper); + bicubicColor.swap(xformedColor); } fragBuilder->codeAppendf("\t%s = %s;\n", args.fOutputColor, (GrGLSLExpr4(bicubicColor.c_str()) * |