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

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

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 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/effects/GrDitherEffect.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 "GrFragmentProcessor.h"
12 12
13 class GrGammaEffect : public GrFragmentProcessor { 13 class GrGammaEffect : public GrFragmentProcessor {
14 public: 14 public:
15 enum class Mode { 15 enum class Mode {
16 kLinearToSRGB, 16 kLinearToSRGB,
17 kSRGBToLinear, 17 kSRGBToLinear,
18 kExponential, 18 kExponential,
19 }; 19 };
20 20
21 /** 21 /**
22 * Creates an effect that applies a gamma curve. 22 * Creates an effect that applies a gamma curve.
23 */ 23 */
24 static const GrFragmentProcessor* Create(SkScalar gamma); 24 static sk_sp<GrFragmentProcessor> Make(SkScalar gamma);
25 25
26 const char* name() const override { return "Gamma"; } 26 const char* name() const override { return "Gamma"; }
27 27
28 Mode mode() const { return fMode; } 28 Mode mode() const { return fMode; }
29 SkScalar gamma() const { return fGamma; } 29 SkScalar gamma() const { return fGamma; }
30 30
31 private: 31 private:
32 GrGammaEffect(Mode mode, SkScalar gamma); 32 GrGammaEffect(Mode mode, SkScalar gamma);
33 33
34 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; 34 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
35 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; 35 void onGetGLSLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override;
36 bool onIsEqual(const GrFragmentProcessor&) const override; 36 bool onIsEqual(const GrFragmentProcessor&) const override;
37 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; 37 void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
38 38
39 Mode fMode; 39 Mode fMode;
40 SkScalar fGamma; 40 SkScalar fGamma;
41 41
42 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 42 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
43 43
44 typedef GrFragmentProcessor INHERITED; 44 typedef GrFragmentProcessor INHERITED;
45 }; 45 };
46 46
47 #endif 47 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDitherEffect.cpp ('k') | src/gpu/effects/GrGammaEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698