| 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 * Helper for isOpaque and isOpaqueAndConstantColor. |
| 198 */ |
| 199 bool getOpaqueAndKnownColor(GrColor* solidColor, uint32_t* solidColorKnownCo
mponents) const; |
| 200 |
| 202 friend class GrContext; // To access above two functions | 201 friend class GrContext; // To access above two functions |
| 203 friend class GrStencilAndCoverTextContext; // To access above two functions | 202 friend class GrStencilAndCoverTextContext; // To access above two functions |
| 204 | 203 |
| 205 SkAutoTUnref<const GrXPFactory> fXPFactory; | 204 SkAutoTUnref<const GrXPFactory> fXPFactory; |
| 206 SkSTArray<4, GrFragmentStage> fColorStages; | 205 SkSTArray<4, GrFragmentStage> fColorStages; |
| 207 SkSTArray<2, GrFragmentStage> fCoverageStages; | 206 SkSTArray<2, GrFragmentStage> fCoverageStages; |
| 208 | 207 |
| 209 bool fAntiAlias; | 208 bool fAntiAlias; |
| 210 bool fDither; | 209 bool fDither; |
| 211 | 210 |
| 212 GrColor fColor; | 211 GrColor fColor; |
| 213 | 212 |
| 214 void resetOptions() { | 213 void resetOptions() { |
| 215 fAntiAlias = false; | 214 fAntiAlias = false; |
| 216 fDither = false; | 215 fDither = false; |
| 217 } | 216 } |
| 218 | 217 |
| 219 void resetColor() { | 218 void resetColor() { |
| 220 fColor = GrColorPackRGBA(0xff, 0xff, 0xff, 0xff); | 219 fColor = GrColorPackRGBA(0xff, 0xff, 0xff, 0xff); |
| 221 } | 220 } |
| 222 | 221 |
| 223 void resetStages(); | 222 void resetStages(); |
| 224 }; | 223 }; |
| 225 | 224 |
| 226 #endif | 225 #endif |
| OLD | NEW |