Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Side by Side Diff: src/gpu/effects/GrGammaEffect.h

Issue 1964943003: Revert of Make GrGammaEffect have explicit sRGB modes, plus exponential mode. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/effects/GrGammaEffect.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrGammaEffect_DEFINED 8 #ifndef GrGammaEffect_DEFINED
9 #define GrGammaEffect_DEFINED 9 #define GrGammaEffect_DEFINED
10 10
11 #include "GrFragmentProcessor.h" 11 #include "GrSingleTextureEffect.h"
12 12
13 class GrGammaEffect : public GrFragmentProcessor { 13 class GrGammaEffect : public GrSingleTextureEffect {
14 public: 14 public:
15 enum class Mode {
16 kLinearToSRGB,
17 kSRGBToLinear,
18 kExponential,
19 };
20
21 /** 15 /**
22 * Creates an effect that applies a gamma curve. 16 * Creates an effect that applies a gamma curve. The source texture is alway s
23 */ 17 * sampled unfiltered and with clamping.
24 static const GrFragmentProcessor* Create(SkScalar gamma); 18 */
19 static const GrFragmentProcessor* Create(GrTexture*, SkScalar gamma);
25 20
26 const char* name() const override { return "Gamma"; } 21 const char* name() const override { return "Gamma"; }
27 22
28 Mode mode() const { return fMode; } 23 bool gammaIsSRGB() const { return fGammaIsSRGB; }
29 SkScalar gamma() const { return fGamma; } 24 SkScalar gamma() const { return fGamma; }
30 25
31 private: 26 private:
32 GrGammaEffect(Mode mode, SkScalar gamma); 27 GrGammaEffect(GrTexture*, SkScalar gamma);
33 28
34 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; 29 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
35 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; 30 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
36 bool onIsEqual(const GrFragmentProcessor&) const override; 31 bool onIsEqual(const GrFragmentProcessor&) const override;
37 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; 32 void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
38 33
39 Mode fMode; 34 bool fGammaIsSRGB;
40 SkScalar fGamma; 35 SkScalar fGamma;
41 36
42 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 37 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
43 38
44 typedef GrFragmentProcessor INHERITED; 39 typedef GrSingleTextureEffect INHERITED;
45 }; 40 };
46 41
47 #endif 42 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/effects/GrGammaEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698