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

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

Issue 1954863002: Make GrGammaEffect have explicit sRGB modes, plus exponential mode. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: powf -> pow in shader code 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 "GrSingleTextureEffect.h" 11 #include "GrFragmentProcessor.h"
12 12
13 class GrGammaEffect : public GrSingleTextureEffect { 13 class GrGammaEffect : public GrFragmentProcessor {
14 public: 14 public:
15 enum class Mode {
16 kLinearToSRGB,
17 kSRGBToLinear,
18 kExponential,
19 };
20
15 /** 21 /**
16 * Creates an effect that applies a gamma curve. The source texture is alway s 22 * Creates an effect that applies a gamma curve.
17 * sampled unfiltered and with clamping. 23 */
18 */ 24 static const GrFragmentProcessor* Create(SkScalar gamma);
19 static const GrFragmentProcessor* Create(GrTexture*, SkScalar gamma);
20 25
21 const char* name() const override { return "Gamma"; } 26 const char* name() const override { return "Gamma"; }
22 27
23 bool gammaIsSRGB() const { return fGammaIsSRGB; } 28 Mode mode() const { return fMode; }
24 SkScalar gamma() const { return fGamma; } 29 SkScalar gamma() const { return fGamma; }
25 30
26 private: 31 private:
27 GrGammaEffect(GrTexture*, SkScalar gamma); 32 GrGammaEffect(Mode mode, SkScalar gamma);
28 33
29 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; 34 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
30 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; 35 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
31 bool onIsEqual(const GrFragmentProcessor&) const override; 36 bool onIsEqual(const GrFragmentProcessor&) const override;
32 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; 37 void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
33 38
34 bool fGammaIsSRGB; 39 Mode fMode;
35 SkScalar fGamma; 40 SkScalar fGamma;
36 41
37 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 42 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
38 43
39 typedef GrSingleTextureEffect INHERITED; 44 typedef GrFragmentProcessor INHERITED;
40 }; 45 };
41 46
42 #endif 47 #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