Index: src/gpu/effects/GrColorSpaceEffect.h |
diff --git a/src/gpu/effects/GrColorSpaceEffect.h b/src/gpu/effects/GrColorSpaceEffect.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f0bfbd906785c0e0b6e2fec254ceb5568b1af688 |
--- /dev/null |
+++ b/src/gpu/effects/GrColorSpaceEffect.h |
@@ -0,0 +1,52 @@ |
+/* |
+ * Copyright 2016 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#ifndef GrColorSpaceEffect_DEFINED |
+#define GrColorSpaceEffect_DEFINED |
+ |
+#include "GrSingleTextureEffect.h" |
+ |
+#include "SkColorSpace.h" |
+ |
+class GrColorSpaceEffect : public GrSingleTextureEffect { |
+public: |
+ /** |
+ * Creates an effect that performs linear -> sRGB conversion. |
+ */ |
+ static const GrFragmentProcessor* Create(GrTexture*, |
+ const SkColorSpace* srcColorSpace, |
+ const SkColorSpace* dstColorSpace, |
+ uint32_t colorSpaceOpsFlags); |
+ |
+ const char* name() const override { return "Color Space"; } |
+ |
+ bool manualDstGamma() const { return fManualDstGamma; } |
+ bool gammaIsSRGB() const { return fGammaIsSRGB; } |
+ const SkFloat3& gamma() const { return fGamma; } |
+ |
+private: |
+ GrColorSpaceEffect(GrTexture*, const SkColorSpace* srcColorSpace, |
+ const SkColorSpace* dstColorSpace, uint32_t colorSpaceOpsFlags); |
+ |
+ GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
+ |
+ void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; |
+ |
+ bool onIsEqual(const GrFragmentProcessor&) const override; |
+ |
+ void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
+ |
+ bool fManualDstGamma; |
+ bool fGammaIsSRGB; |
+ SkFloat3 fGamma; |
+ |
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
+ |
+ typedef GrSingleTextureEffect INHERITED; |
+}; |
+ |
+#endif |