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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 */ | 167 */ |
168 void reset() { | 168 void reset() { |
169 this->resetBlend(); | 169 this->resetBlend(); |
170 this->resetOptions(); | 170 this->resetOptions(); |
171 this->resetColor(); | 171 this->resetColor(); |
172 this->resetCoverage(); | 172 this->resetCoverage(); |
173 this->resetStages(); | 173 this->resetStages(); |
174 this->resetColorFilter(); | 174 this->resetColorFilter(); |
175 } | 175 } |
176 | 176 |
| 177 /** |
| 178 * Determines whether the drawing with this paint is opaque with respect to
both color blending |
| 179 * and fractional coverage. It does not consider whether AA has been enabled
on the paint or |
| 180 * not. Depending upon whether multisampling or coverage-based AA is in use,
AA may make the |
| 181 * result only apply to the interior of primitives. |
| 182 * |
| 183 */ |
| 184 bool isOpaque() const; |
| 185 |
| 186 /** |
| 187 * Returns true if isOpaque would return true and the paint represents a sol
id constant color |
| 188 * draw. If the result is true, constantColor will be updated to contain the
constant color. |
| 189 */ |
| 190 bool isOpaqueAndConstantColor(GrColor* constantColor) const; |
| 191 |
177 private: | 192 private: |
| 193 |
| 194 /** |
| 195 * Helper for isOpaque and isOpaqueAndConstantColor. |
| 196 */ |
| 197 bool getOpaqueAndKnownColor(GrColor* solidColor, uint32_t* solidColorKnownCo
mponents) const; |
| 198 |
178 /** | 199 /** |
179 * Called when the source coord system from which geometry is rendered chang
es. It ensures that | 200 * Called when the source coord system from which geometry is rendered chang
es. It ensures that |
180 * the local coordinates seen by effects remains unchanged. oldToNew gives t
he transformation | 201 * the local coordinates seen by effects remains unchanged. oldToNew gives t
he transformation |
181 * from the previous coord system to the new coord system. | 202 * from the previous coord system to the new coord system. |
182 */ | 203 */ |
183 void localCoordChange(const SkMatrix& oldToNew) { | 204 void localCoordChange(const SkMatrix& oldToNew) { |
184 for (int i = 0; i < fColorStages.count(); ++i) { | 205 for (int i = 0; i < fColorStages.count(); ++i) { |
185 fColorStages[i].localCoordChange(oldToNew); | 206 fColorStages[i].localCoordChange(oldToNew); |
186 } | 207 } |
187 for (int i = 0; i < fCoverageStages.count(); ++i) { | 208 for (int i = 0; i < fCoverageStages.count(); ++i) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 fCoverage = 0xff; | 266 fCoverage = 0xff; |
246 } | 267 } |
247 | 268 |
248 void resetStages() { | 269 void resetStages() { |
249 fColorStages.reset(); | 270 fColorStages.reset(); |
250 fCoverageStages.reset(); | 271 fCoverageStages.reset(); |
251 } | 272 } |
252 }; | 273 }; |
253 | 274 |
254 #endif | 275 #endif |
OLD | NEW |