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 GrInvariantOutput_DEFINED | 8 #ifndef GrInvariantOutput_DEFINED |
9 #define GrInvariantOutput_DEFINED | 9 #define GrInvariantOutput_DEFINED |
10 | 10 |
11 #include "GrColor.h" | 11 #include "GrColor.h" |
12 | 12 |
13 class GrInvariantOutput { | 13 class GrInvariantOutput { |
14 public: | 14 public: |
15 GrInvariantOutput(GrColor color, GrColorComponentFlags flags, bool isSingleC
omponent) | 15 GrInvariantOutput(GrColor color, GrColorComponentFlags flags, bool isSingleC
omponent) |
16 : fColor(color), fValidFlags(flags), fIsSingleComponent(isSingleComponen
t), | 16 : fColor(color) |
17 fNonMulStageFound(false), fWillUseInputColor(true) {} | 17 , fValidFlags(flags) |
| 18 , fIsSingleComponent(isSingleComponent) |
| 19 , fNonMulStageFound(false) |
| 20 , fWillUseInputColor(true) |
| 21 , fIsLCDCoverage(false) {} |
18 | 22 |
19 virtual ~GrInvariantOutput() {} | 23 virtual ~GrInvariantOutput() {} |
20 | 24 |
21 enum ReadInput { | 25 enum ReadInput { |
22 kWill_ReadInput, | 26 kWill_ReadInput, |
23 kWillNot_ReadInput, | 27 kWillNot_ReadInput, |
24 }; | 28 }; |
25 | 29 |
26 void mulByUnknownOpaqueColor() { | 30 void mulByUnknownOpaqueColor() { |
27 if (this->isOpaque()) { | 31 if (this->isOpaque()) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 89 } |
86 | 90 |
87 void setToUnknown(ReadInput readsInput) { | 91 void setToUnknown(ReadInput readsInput) { |
88 this->internalSetToUnknown(); | 92 this->internalSetToUnknown(); |
89 fNonMulStageFound= true; | 93 fNonMulStageFound= true; |
90 if (kWillNot_ReadInput == readsInput) { | 94 if (kWillNot_ReadInput == readsInput) { |
91 fWillUseInputColor = false; | 95 fWillUseInputColor = false; |
92 } | 96 } |
93 } | 97 } |
94 | 98 |
| 99 // Temporary setter to handle LCD text correctly until we improve texture pi
xel config queries |
| 100 // and thus can rely solely on number of coverage components for RGA vs sing
le channel coverage. |
| 101 void setUsingLCDCoverage() { |
| 102 fIsLCDCoverage = true; |
| 103 } |
| 104 |
95 GrColor color() const { return fColor; } | 105 GrColor color() const { return fColor; } |
96 uint8_t validFlags() const { return fValidFlags; } | 106 uint8_t validFlags() const { return fValidFlags; } |
97 | 107 |
98 /** | 108 /** |
99 * If isSingleComponent is true, then the flag values for r, g, b, and a mus
t all be the | 109 * If isSingleComponent is true, then the flag values for r, g, b, and a mus
t all be the |
100 * same. If the flags are all set then all color components must be equal. | 110 * same. If the flags are all set then all color components must be equal. |
101 */ | 111 */ |
102 SkDEBUGCODE(void validate() const;) | 112 SkDEBUGCODE(void validate() const;) |
103 | 113 |
104 protected: | |
105 GrColor fColor; | |
106 uint32_t fValidFlags; | |
107 bool fIsSingleComponent; | |
108 bool fNonMulStageFound; | |
109 bool fWillUseInputColor; | |
110 | |
111 private: | 114 private: |
112 friend class GrProcOptInfo; | 115 friend class GrProcOptInfo; |
113 | 116 |
114 void reset(GrColor color, GrColorComponentFlags flags, bool isSingleComponen
t) { | 117 void reset(GrColor color, GrColorComponentFlags flags, bool isSingleComponen
t) { |
115 fColor = color; | 118 fColor = color; |
116 fValidFlags = flags; | 119 fValidFlags = flags; |
117 fIsSingleComponent = isSingleComponent; | 120 fIsSingleComponent = isSingleComponent; |
118 fNonMulStageFound = false; | 121 fNonMulStageFound = false; |
119 fWillUseInputColor = true; | 122 fWillUseInputColor = true; |
120 } | 123 } |
(...skipping 21 matching lines...) Expand all Loading... |
142 return (fValidFlags == kRGBA_GrColorComponentFlags && 0xFFFFFFFF == fCol
or); | 145 return (fValidFlags == kRGBA_GrColorComponentFlags && 0xFFFFFFFF == fCol
or); |
143 } | 146 } |
144 | 147 |
145 bool isSingleComponent() const { return fIsSingleComponent; } | 148 bool isSingleComponent() const { return fIsSingleComponent; } |
146 | 149 |
147 bool willUseInputColor() const { return fWillUseInputColor; } | 150 bool willUseInputColor() const { return fWillUseInputColor; } |
148 void resetWillUseInputColor() { fWillUseInputColor = true; } | 151 void resetWillUseInputColor() { fWillUseInputColor = true; } |
149 | 152 |
150 void resetNonMulStageFound() { fNonMulStageFound = false; } | 153 void resetNonMulStageFound() { fNonMulStageFound = false; } |
151 | 154 |
| 155 bool isLCDCoverage() const { return fIsLCDCoverage; } |
| 156 |
152 SkDEBUGCODE(bool colorComponentsAllEqual() const;) | 157 SkDEBUGCODE(bool colorComponentsAllEqual() const;) |
153 /** | 158 /** |
154 * If alpha is valid, check that any valid R,G,B values are <= A | 159 * If alpha is valid, check that any valid R,G,B values are <= A |
155 */ | 160 */ |
156 SkDEBUGCODE(bool validPreMulColor() const;) | 161 SkDEBUGCODE(bool validPreMulColor() const;) |
| 162 |
| 163 GrColor fColor; |
| 164 uint32_t fValidFlags; |
| 165 bool fIsSingleComponent; |
| 166 bool fNonMulStageFound; |
| 167 bool fWillUseInputColor; |
| 168 bool fIsLCDCoverage; // Temorary data member until texture pixel configs are
updated |
| 169 |
157 }; | 170 }; |
158 | 171 |
159 #endif | 172 #endif |
160 | 173 |
OLD | NEW |