| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 /** | 135 /** |
| 136 * Resets the paint to the defaults. | 136 * Resets the paint to the defaults. |
| 137 */ | 137 */ |
| 138 void reset() { | 138 void reset() { |
| 139 this->resetOptions(); | 139 this->resetOptions(); |
| 140 this->resetColor(); | 140 this->resetColor(); |
| 141 this->resetStages(); | 141 this->resetStages(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 /** | 144 /** |
| 145 * Determines whether the drawing with this paint is opaque with respect to
both color blending | |
| 146 * and fractional coverage. It does not consider whether AA has been enabled
on the paint or | |
| 147 * not. Depending upon whether multisampling or coverage-based AA is in use,
AA may make the | |
| 148 * result only apply to the interior of primitives. | |
| 149 * | |
| 150 */ | |
| 151 bool isOpaque() const; | |
| 152 | |
| 153 /** | |
| 154 * Returns true if isOpaque would return true and the paint represents a sol
id constant color | 145 * 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. | 146 * draw. If the result is true, constantColor will be updated to contain the
constant color. |
| 156 */ | 147 */ |
| 157 bool isOpaqueAndConstantColor(GrColor* constantColor) const; | 148 bool isOpaqueAndConstantColor(GrColor* constantColor) const; |
| 158 | 149 |
| 159 /** | 150 /** |
| 160 * Called when the source coord system from which geometry is rendered chang
es. It ensures that | 151 * Called when the source coord system from which geometry is rendered chang
es. It ensures that |
| 161 * the local coordinates seen by effects remains unchanged. oldToNew gives t
he transformation | 152 * the local coordinates seen by effects remains unchanged. oldToNew gives t
he transformation |
| 162 * from the previous coord system to the new coord system. | 153 * from the previous coord system to the new coord system. |
| 163 */ | 154 */ |
| (...skipping 22 matching lines...) Expand all Loading... |
| 186 return false; | 177 return false; |
| 187 } else { | 178 } else { |
| 188 computed = true; | 179 computed = true; |
| 189 } | 180 } |
| 190 fCoverageStages[i].localCoordChange(oldToNew); | 181 fCoverageStages[i].localCoordChange(oldToNew); |
| 191 } | 182 } |
| 192 return true; | 183 return true; |
| 193 } | 184 } |
| 194 | 185 |
| 195 private: | 186 private: |
| 196 /** | |
| 197 * Helper for isOpaque and isOpaqueAndConstantColor. | |
| 198 */ | |
| 199 bool getOpaqueAndKnownColor(GrColor* solidColor, uint32_t* solidColorKnownCo
mponents) const; | |
| 200 | |
| 201 friend class GrContext; // To access above two functions | 187 friend class GrContext; // To access above two functions |
| 202 friend class GrStencilAndCoverTextContext; // To access above two functions | 188 friend class GrStencilAndCoverTextContext; // To access above two functions |
| 203 | 189 |
| 204 SkAutoTUnref<const GrXPFactory> fXPFactory; | 190 SkAutoTUnref<const GrXPFactory> fXPFactory; |
| 205 SkSTArray<4, GrFragmentStage> fColorStages; | 191 SkSTArray<4, GrFragmentStage> fColorStages; |
| 206 SkSTArray<2, GrFragmentStage> fCoverageStages; | 192 SkSTArray<2, GrFragmentStage> fCoverageStages; |
| 207 | 193 |
| 208 bool fAntiAlias; | 194 bool fAntiAlias; |
| 209 bool fDither; | 195 bool fDither; |
| 210 | 196 |
| 211 GrColor fColor; | 197 GrColor fColor; |
| 212 | 198 |
| 213 void resetOptions() { | 199 void resetOptions() { |
| 214 fAntiAlias = false; | 200 fAntiAlias = false; |
| 215 fDither = false; | 201 fDither = false; |
| 216 } | 202 } |
| 217 | 203 |
| 218 void resetColor() { | 204 void resetColor() { |
| 219 fColor = GrColorPackRGBA(0xff, 0xff, 0xff, 0xff); | 205 fColor = GrColorPackRGBA(0xff, 0xff, 0xff, 0xff); |
| 220 } | 206 } |
| 221 | 207 |
| 222 void resetStages(); | 208 void resetStages(); |
| 223 }; | 209 }; |
| 224 | 210 |
| 225 #endif | 211 #endif |
| OLD | NEW |