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

Side by Side Diff: include/gpu/effects/GrConstColorProcessor.h

Issue 1313573005: Revert of Change SkShader;asFragmentProcessor signature to no longer take skpaint\grcolor* (Closed) Base URL: https://skia.googlesource.com/skia.git@things
Patch Set: Created 5 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 GrColorProcessor_DEFINED 8 #ifndef GrColorProcessor_DEFINED
9 #define GrColorProcessor_DEFINED 9 #define GrColorProcessor_DEFINED
10 10
11 #include "GrFragmentProcessor.h" 11 #include "GrFragmentProcessor.h"
12 12
13 class GrInvariantOutput;
14
13 /** 15 /**
14 * This is a simple GrFragmentProcessor that outputs a constant color. It may do one of the 16 * This is a simple GrFragmentProcessor that outputs a constant color. It may do one of the
15 * following with its input color: ignore it, or multiply it by the constant col or, multiply its 17 * following with its input color: ignore it, or multiply it by the constant col or, multiply its
16 * alpha by the constant color and ignore the input color's r, g, and b. 18 * alpha by the constant color and ignore the input color's r, g, and b.
17 */ 19 */
18 class GrConstColorProcessor : public GrFragmentProcessor { 20 class GrConstColorProcessor : public GrFragmentProcessor {
19 public: 21 public:
20 enum InputMode { 22 enum InputMode {
21 kIgnore_InputMode, 23 kIgnore_InputMode,
22 kModulateRGBA_InputMode, 24 kModulateRGBA_InputMode,
23 kModulateA_InputMode, 25 kModulateA_InputMode,
24 26
25 kLastInputMode = kModulateA_InputMode 27 kLastInputMode = kModulateA_InputMode
26 }; 28 };
27 static const int kInputModeCnt = kLastInputMode + 1; 29 static const int kInputModeCnt = kLastInputMode + 1;
28 30
29 static GrFragmentProcessor* Create(GrColor color, InputMode mode) { 31 static GrFragmentProcessor* Create(GrColor color, InputMode mode) {
30 return new GrConstColorProcessor(color, mode); 32 return new GrConstColorProcessor(color, mode);
31 } 33 }
32 34
35 ~GrConstColorProcessor() override {}
36
33 const char* name() const override { return "Color"; } 37 const char* name() const override { return "Color"; }
34 38
35 GrColor color() const { return fColor; } 39 GrColor color() const { return fColor; }
36 40
37 InputMode inputMode() const { return fMode; } 41 InputMode inputMode() const { return fMode; }
38 42
39 private: 43 private:
40 GrConstColorProcessor(GrColor color, InputMode mode) : fColor(color), fMode( mode) { 44 GrConstColorProcessor(GrColor color, InputMode mode) : fColor(color), fMode( mode) {
41 this->initClassID<GrConstColorProcessor>(); 45 this->initClassID<GrConstColorProcessor>();
42 } 46 }
43 47
44 GrGLFragmentProcessor* onCreateGLInstance() const override; 48 GrGLFragmentProcessor* onCreateGLInstance() const override;
45 49
46 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov erride; 50 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov erride;
47 51
48 bool onIsEqual(const GrFragmentProcessor&) const override; 52 bool onIsEqual(const GrFragmentProcessor&) const override;
49 53
50 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; 54 void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
51 55
52 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 56 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
53 57
54 GrColor fColor; 58 GrColor fColor;
55 InputMode fMode; 59 InputMode fMode;
56 60
57 typedef GrFragmentProcessor INHERITED; 61 typedef GrFragmentProcessor INHERITED;
58 }; 62 };
59 63
60 #endif 64 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrProcessorUnitTest.h ('k') | include/gpu/effects/GrExtractAlphaFragmentProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698