Index: src/gpu/effects/GrGammaEffect.h |
diff --git a/src/gpu/effects/GrGammaEffect.h b/src/gpu/effects/GrGammaEffect.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e53ec29b2511053818727774c01f60c31b7a40a5 |
--- /dev/null |
+++ b/src/gpu/effects/GrGammaEffect.h |
@@ -0,0 +1,41 @@ |
+/* |
+ * 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 GrGammaEffect_DEFINED |
+#define GrGammaEffect_DEFINED |
+ |
+#include "GrSingleTextureEffect.h" |
+ |
+class GrGammaEffect : public GrSingleTextureEffect { |
+public: |
+ /** |
+ * Creates an effect that applies a gamma curve. |
bsalomon
2016/04/29 18:27:20
Doc how src is sampled (always nearest)?
Brian Osman
2016/05/02 21:02:45
Done.
|
+ */ |
+ static const GrFragmentProcessor* Create(GrTexture*, SkScalar gamma); |
+ |
+ const char* name() const override { return "Gamma"; } |
+ |
+ bool gammaIsSRGB() const { return fGammaIsSRGB; } |
+ SkScalar gamma() const { return fGamma; } |
+ |
+private: |
+ GrGammaEffect(GrTexture*, SkScalar gamma); |
+ |
+ GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
+ void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; |
+ bool onIsEqual(const GrFragmentProcessor&) const override; |
+ void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
+ |
+ bool fGammaIsSRGB; |
+ SkScalar fGamma; |
+ |
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
+ |
+ typedef GrSingleTextureEffect INHERITED; |
+}; |
+ |
+#endif |