OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2016 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #ifndef GrGammaEffect_DEFINED |
| 9 #define GrGammaEffect_DEFINED |
| 10 |
| 11 #include "GrSingleTextureEffect.h" |
| 12 |
| 13 class GrGammaEffect : public GrSingleTextureEffect { |
| 14 public: |
| 15 /** |
| 16 * Creates an effect that applies a gamma curve. The source texture is alway
s |
| 17 * sampled unfiltered and with clamping. |
| 18 */ |
| 19 static const GrFragmentProcessor* Create(GrTexture*, SkScalar gamma); |
| 20 |
| 21 const char* name() const override { return "Gamma"; } |
| 22 |
| 23 bool gammaIsSRGB() const { return fGammaIsSRGB; } |
| 24 SkScalar gamma() const { return fGamma; } |
| 25 |
| 26 private: |
| 27 GrGammaEffect(GrTexture*, SkScalar gamma); |
| 28 |
| 29 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
| 30 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const
override; |
| 31 bool onIsEqual(const GrFragmentProcessor&) const override; |
| 32 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
| 33 |
| 34 bool fGammaIsSRGB; |
| 35 SkScalar fGamma; |
| 36 |
| 37 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
| 38 |
| 39 typedef GrSingleTextureEffect INHERITED; |
| 40 }; |
| 41 |
| 42 #endif |
OLD | NEW |