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

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

Issue 978713002: Add constant color GrFP. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 5 years, 9 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
(Empty)
1 /*
2 * Copyright 2015 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 GrColorProcessor_DEFINED
9 #define GrColorProcessor_DEFINED
10
11 #include "GrFragmentProcessor.h"
12
13 class GrInvariantOutput;
14
15 /**
16 * This is a simple GrFragmentProcessor that simply outputs a constant color. It may do one of the
egdaniel 2015/03/04 20:22:34 maybe "This is a simple GrFragmentProcessor that s
bsalomon 2015/03/31 19:33:42 Done. :)
17 * following with its input color: ignore it, multiply it by the constant color, multiply its alpha
egdaniel 2015/03/04 20:22:34 , or multiply
bsalomon 2015/03/31 19:33:42 Done.
18 * by the constant color and ignore the input color's r, g, and b.
19 */
20 class GrColorProcessor : public GrFragmentProcessor {
egdaniel 2015/03/04 20:22:34 Can we call this GrContColorProcessor, or somethin
bsalomon 2015/03/31 19:33:42 Done.
21 public:
22 enum InputMode {
23 kIgnore_InputMode,
24 kModulateRGBA_InputMode,
25 kModulateA_InputMode,
26
27 kLastInputMode = kModulateA_InputMode
28 };
29 static const int kInputModeCnt = kLastInputMode + 1;
30
31 static GrFragmentProcessor* Create(GrColor color, InputMode mode) {
32 return SkNEW_ARGS(GrColorProcessor, (color, mode));
33 }
34
35 ~GrColorProcessor() SK_OVERRIDE {}
36
37 const char* name() const SK_OVERRIDE { return "Color"; }
38
39 void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const SK_OVE RRIDE;
40
41 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE;
42
43 GrColor color() const { return fColor; }
44
45 InputMode inputMode() const { return fMode; }
46
47 private:
48 GrColorProcessor(GrColor color, InputMode mode) : fColor(color), fMode(mode) {
49 this->initClassID<GrColorProcessor>();
50 }
51
52 bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE;
53
54 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE;
55
56 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
57
58 GrColor fColor;
59 InputMode fMode;
60
61 typedef GrFragmentProcessor INHERITED;
62 };
63
64 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698