diff options
author | 2017-03-08 11:42:02 -0500 | |
---|---|---|
committer | 2017-03-08 18:52:51 +0000 | |
commit | c624d9d212c4168fc6c202a8535ddff8a3bfb16a (patch) | |
tree | 51606298f16184f05b2f5414e547d1291f5ccca7 /src/gpu/effects/GrBicubicEffect.cpp | |
parent | e353e81a6fdf401310e0643280ec34d9de0019a3 (diff) |
Refactor GrColorSpaceXformHelper
Nonlinear blending mode is going to (sometimes) require additional
uniforms and shader code for color space transformation.
This change just alters the usage of the helper struct so that we can
hide any new logic (without having to change all the FPs that use it).
BUG=skia:
Change-Id: I913478a387973f5bad5aa09a29f85d21daacab94
Reviewed-on: https://skia-review.googlesource.com/9414
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/effects/GrBicubicEffect.cpp')
-rw-r--r-- | src/gpu/effects/GrBicubicEffect.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp index 5f06fc166a..ec7ad79475 100644 --- a/src/gpu/effects/GrBicubicEffect.cpp +++ b/src/gpu/effects/GrBicubicEffect.cpp @@ -32,7 +32,7 @@ private: typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; UniformHandle fImageIncrementUni; - UniformHandle fColorSpaceXformUni; + GrGLSLColorSpaceXformHelper fColorSpaceHelper; GrTextureDomain::GLDomain fDomain; typedef GrGLSLFragmentProcessor INHERITED; @@ -48,8 +48,7 @@ void GrGLBicubicEffect::emitCode(EmitArgs& args) { const char* imgInc = uniformHandler->getUniformCStr(fImageIncrementUni); - GrGLSLColorSpaceXformHelper colorSpaceHelper(uniformHandler, bicubicEffect.colorSpaceXform(), - &fColorSpaceXformUni); + fColorSpaceHelper.emitCode(uniformHandler, bicubicEffect.colorSpaceXform()); GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]); @@ -107,9 +106,9 @@ void GrGLBicubicEffect::emitCode(EmitArgs& args) { y); } SkString bicubicColor("(wy.x * s0 + wy.y * s1 + wy.z * s2 + wy.w * s3)"); - if (colorSpaceHelper.getXformMatrix()) { + if (fColorSpaceHelper.isValid()) { SkString xformedColor; - fragBuilder->appendColorGamutXform(&xformedColor, bicubicColor.c_str(), &colorSpaceHelper); + fragBuilder->appendColorGamutXform(&xformedColor, bicubicColor.c_str(), &fColorSpaceHelper); bicubicColor.swap(xformedColor); } fragBuilder->codeAppendf("%s = %s;", @@ -127,7 +126,7 @@ void GrGLBicubicEffect::onSetData(const GrGLSLProgramDataManager& pdman, pdman.set2fv(fImageIncrementUni, 1, imageIncrement); fDomain.setData(pdman, bicubicEffect.domain(), texture); if (SkToBool(bicubicEffect.colorSpaceXform())) { - pdman.setSkMatrix44(fColorSpaceXformUni, bicubicEffect.colorSpaceXform()->srcToDst()); + fColorSpaceHelper.setData(pdman, bicubicEffect.colorSpaceXform()); } } |