OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef GrPaint_DEFINED | 10 #ifndef GrPaint_DEFINED |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 * | 149 * |
150 */ | 150 */ |
151 bool isOpaque() const; | 151 bool isOpaque() const; |
152 | 152 |
153 /** | 153 /** |
154 * Returns true if isOpaque would return true and the paint represents a sol id constant color | 154 * Returns true if isOpaque would return true and the paint represents a sol id constant color |
155 * draw. If the result is true, constantColor will be updated to contain the constant color. | 155 * draw. If the result is true, constantColor will be updated to contain the constant color. |
156 */ | 156 */ |
157 bool isOpaqueAndConstantColor(GrColor* constantColor) const; | 157 bool isOpaqueAndConstantColor(GrColor* constantColor) const; |
158 | 158 |
159 private: | |
160 | |
161 /** | |
162 * Helper for isOpaque and isOpaqueAndConstantColor. | |
163 */ | |
164 bool getOpaqueAndKnownColor(GrColor* solidColor, uint32_t* solidColorKnownCo mponents) const; | |
165 | |
166 /** | 159 /** |
167 * Called when the source coord system from which geometry is rendered chang es. It ensures that | 160 * Called when the source coord system from which geometry is rendered chang es. It ensures that |
168 * the local coordinates seen by effects remains unchanged. oldToNew gives t he transformation | 161 * the local coordinates seen by effects remains unchanged. oldToNew gives t he transformation |
169 * from the previous coord system to the new coord system. | 162 * from the previous coord system to the new coord system. |
170 */ | 163 */ |
171 void localCoordChange(const SkMatrix& oldToNew) { | 164 void localCoordChange(const SkMatrix& oldToNew) { |
172 for (int i = 0; i < fColorStages.count(); ++i) { | 165 for (int i = 0; i < fColorStages.count(); ++i) { |
173 fColorStages[i].localCoordChange(oldToNew); | 166 fColorStages[i].localCoordChange(oldToNew); |
174 } | 167 } |
175 for (int i = 0; i < fCoverageStages.count(); ++i) { | 168 for (int i = 0; i < fCoverageStages.count(); ++i) { |
(...skipping 16 matching lines...) Expand all Loading... | |
192 if (!computed && !newToOld.invert(&oldToNew)) { | 185 if (!computed && !newToOld.invert(&oldToNew)) { |
193 return false; | 186 return false; |
194 } else { | 187 } else { |
195 computed = true; | 188 computed = true; |
196 } | 189 } |
197 fCoverageStages[i].localCoordChange(oldToNew); | 190 fCoverageStages[i].localCoordChange(oldToNew); |
198 } | 191 } |
199 return true; | 192 return true; |
200 } | 193 } |
201 | 194 |
195 private: | |
196 | |
197 /** | |
bsalomon
2014/12/17 17:12:33
tx
| |
198 * Helper for isOpaque and isOpaqueAndConstantColor. | |
199 */ | |
200 bool getOpaqueAndKnownColor(GrColor* solidColor, uint32_t* solidColorKnownCo mponents) const; | |
201 | |
202 friend class GrContext; // To access above two functions | 202 friend class GrContext; // To access above two functions |
203 friend class GrStencilAndCoverTextContext; // To access above two functions | 203 friend class GrStencilAndCoverTextContext; // To access above two functions |
204 | 204 |
205 SkAutoTUnref<const GrXPFactory> fXPFactory; | 205 SkAutoTUnref<const GrXPFactory> fXPFactory; |
206 SkSTArray<4, GrFragmentStage> fColorStages; | 206 SkSTArray<4, GrFragmentStage> fColorStages; |
207 SkSTArray<2, GrFragmentStage> fCoverageStages; | 207 SkSTArray<2, GrFragmentStage> fCoverageStages; |
208 | 208 |
209 bool fAntiAlias; | 209 bool fAntiAlias; |
210 bool fDither; | 210 bool fDither; |
211 | 211 |
212 GrColor fColor; | 212 GrColor fColor; |
213 | 213 |
214 void resetOptions() { | 214 void resetOptions() { |
215 fAntiAlias = false; | 215 fAntiAlias = false; |
216 fDither = false; | 216 fDither = false; |
217 } | 217 } |
218 | 218 |
219 void resetColor() { | 219 void resetColor() { |
220 fColor = GrColorPackRGBA(0xff, 0xff, 0xff, 0xff); | 220 fColor = GrColorPackRGBA(0xff, 0xff, 0xff, 0xff); |
221 } | 221 } |
222 | 222 |
223 void resetStages(); | 223 void resetStages(); |
224 }; | 224 }; |
225 | 225 |
226 #endif | 226 #endif |
OLD | NEW |