OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrDisableColorXP_DEFINED | 8 #ifndef GrDisableColorXP_DEFINED |
9 #define GrDisableColorXP_DEFINED | 9 #define GrDisableColorXP_DEFINED |
10 | 10 |
11 #include "GrTypes.h" | 11 #include "GrTypes.h" |
12 #include "GrXferProcessor.h" | 12 #include "GrXferProcessor.h" |
13 | 13 |
14 class GrProcOptInfo; | 14 class GrProcOptInfo; |
15 | 15 |
16 /** | |
17 * This xfer processor disables color writing. Thus color and coverage and ignor
ed and no blending | |
18 * occurs. This XP is usful for things like stenciling. | |
19 */ | |
20 class GrDisableColorXP : public GrXferProcessor { | |
21 public: | |
22 static GrXferProcessor* Create() { | |
23 return SkNEW(GrDisableColorXP); | |
24 } | |
25 | |
26 ~GrDisableColorXP() SK_OVERRIDE {}; | |
27 | |
28 const char* name() const SK_OVERRIDE { return "Disable Color"; } | |
29 | |
30 GrGLXferProcessor* createGLInstance() const SK_OVERRIDE; | |
31 | |
32 bool hasSecondaryOutput() const SK_OVERRIDE { return false; } | |
33 | |
34 GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI, | |
35 const GrProcOptInfo& coveragePOI, | |
36 bool doesStencilWrite, | |
37 GrColor* color, | |
38 const GrDrawTargetCaps& caps) SK_
OVERRIDE { | |
39 return GrXferProcessor::kIgnoreColor_OptFlag | GrXferProcessor::kIgnoreC
overage_OptFlag; | |
40 } | |
41 | |
42 void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE; | |
43 | |
44 private: | |
45 GrDisableColorXP(); | |
46 | |
47 void onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) con
st SK_OVERRIDE; | |
48 | |
49 bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE { | |
50 return true; | |
51 } | |
52 | |
53 typedef GrXferProcessor INHERITED; | |
54 }; | |
55 | |
56 /////////////////////////////////////////////////////////////////////////////// | |
57 | |
58 class GrDisableColorXPFactory : public GrXPFactory { | 16 class GrDisableColorXPFactory : public GrXPFactory { |
59 public: | 17 public: |
60 static GrXPFactory* Create() { | 18 static GrXPFactory* Create() { |
61 return SkNEW(GrDisableColorXPFactory); | 19 return SkNEW(GrDisableColorXPFactory); |
62 } | 20 } |
63 | 21 |
64 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const
SK_OVERRIDE { | 22 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const
SK_OVERRIDE { |
65 return true; | 23 return true; |
66 } | 24 } |
67 | 25 |
(...skipping 23 matching lines...) Expand all Loading... |
91 return true; | 49 return true; |
92 } | 50 } |
93 | 51 |
94 GR_DECLARE_XP_FACTORY_TEST; | 52 GR_DECLARE_XP_FACTORY_TEST; |
95 | 53 |
96 typedef GrXPFactory INHERITED; | 54 typedef GrXPFactory INHERITED; |
97 }; | 55 }; |
98 | 56 |
99 #endif | 57 #endif |
100 | 58 |
OLD | NEW |