Index: src/gpu/effects/GrSimpleTextureEffect.cpp |
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp |
index a452d3e6fdf064038996a9c2983ac5c9aa8f6904..8e452814b9567af72ceab292ee8957d1533a25bc 100644 |
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp |
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp |
@@ -8,23 +8,46 @@ |
#include "GrSimpleTextureEffect.h" |
#include "GrInvariantOutput.h" |
#include "GrTexture.h" |
+#include "glsl/GrGLSLColorSpaceXformHelper.h" |
#include "glsl/GrGLSLFragmentProcessor.h" |
#include "glsl/GrGLSLFragmentShaderBuilder.h" |
class GrGLSimpleTextureEffect : public GrGLSLFragmentProcessor { |
public: |
void emitCode(EmitArgs& args) override { |
+ const GrSimpleTextureEffect& textureEffect = args.fFp.cast<GrSimpleTextureEffect>(); |
+ GrGLSLColorSpaceXformHelper colorSpaceHelper(args.fUniformHandler, |
+ textureEffect.colorSpaceXform(), |
+ &fColorSpaceXformUni); |
+ |
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; |
fragBuilder->codeAppendf("%s = ", args.fOutputColor); |
fragBuilder->appendTextureLookupAndModulate(args.fInputColor, |
- args.fTexSamplers[0], |
- args.fCoords[0].c_str(), |
- args.fCoords[0].getType()); |
+ args.fTexSamplers[0], |
+ args.fCoords[0].c_str(), |
+ args.fCoords[0].getType(), |
+ &colorSpaceHelper); |
fragBuilder->codeAppend(";"); |
} |
+ static inline void GenKey(const GrProcessor& effect, const GrGLSLCaps&, |
+ GrProcessorKeyBuilder* b) { |
+ const GrSimpleTextureEffect& textureEffect = effect.cast<GrSimpleTextureEffect>(); |
+ b->add32(GrColorSpaceXform::XformKey(textureEffect.colorSpaceXform())); |
+ } |
+ |
+protected: |
+ void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& processor) override { |
+ const GrSimpleTextureEffect& textureEffect = processor.cast<GrSimpleTextureEffect>(); |
+ if (SkToBool(textureEffect.colorSpaceXform())) { |
+ pdman.setMatrix4f(fColorSpaceXformUni, textureEffect.colorSpaceXform()->srcToDst()); |
+ } |
+ } |
+ |
private: |
typedef GrGLSLFragmentProcessor INHERITED; |
+ |
+ UniformHandle fColorSpaceXformUni; |
}; |
/////////////////////////////////////////////////////////////////////////////// |