| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrDrawState_DEFINED | 8 #ifndef GrDrawState_DEFINED |
| 9 #define GrDrawState_DEFINED | 9 #define GrDrawState_DEFINED |
| 10 | 10 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 /// pixel coverage rather than as input to the src/dst color blend step. | 178 /// pixel coverage rather than as input to the src/dst color blend step. |
| 179 /// | 179 /// |
| 180 /// The input color to the first color-stage is either the constant color or
interpolated | 180 /// The input color to the first color-stage is either the constant color or
interpolated |
| 181 /// per-vertex colors. The input to the first coverage stage is either a con
stant coverage | 181 /// per-vertex colors. The input to the first coverage stage is either a con
stant coverage |
| 182 /// (usually full-coverage) or interpolated per-vertex coverage. | 182 /// (usually full-coverage) or interpolated per-vertex coverage. |
| 183 /// | 183 /// |
| 184 /// See the documentation of kCoverageDrawing_StateBit for information about
disabling the | 184 /// See the documentation of kCoverageDrawing_StateBit for information about
disabling the |
| 185 /// the color / coverage distinction. | 185 /// the color / coverage distinction. |
| 186 //// | 186 //// |
| 187 | 187 |
| 188 const GrEffect* setGeometryProcessor(const GrEffect* effect, int attr0 = -1,
int attr1 = -1) { |
| 189 SkASSERT(NULL != effect); |
| 190 SkASSERT(NULL == this->getGeometryProcessor()); |
| 191 fGeometryProcessor.reset(new GrEffectStage(effect, attr0, attr1)); |
| 192 this->invalidateBlendOptFlags(); |
| 193 return effect; |
| 194 } |
| 195 |
| 188 const GrEffect* addColorEffect(const GrEffect* effect, int attr0 = -1, int a
ttr1 = -1) { | 196 const GrEffect* addColorEffect(const GrEffect* effect, int attr0 = -1, int a
ttr1 = -1) { |
| 189 SkASSERT(NULL != effect); | 197 SkASSERT(NULL != effect); |
| 190 SkNEW_APPEND_TO_TARRAY(&fColorStages, GrEffectStage, (effect, attr0, att
r1)); | 198 SkNEW_APPEND_TO_TARRAY(&fColorStages, GrEffectStage, (effect, attr0, att
r1)); |
| 191 this->invalidateBlendOptFlags(); | 199 this->invalidateBlendOptFlags(); |
| 192 return effect; | 200 return effect; |
| 193 } | 201 } |
| 194 | 202 |
| 195 const GrEffect* addCoverageEffect(const GrEffect* effect, int attr0 = -1, in
t attr1 = -1) { | 203 const GrEffect* addCoverageEffect(const GrEffect* effect, int attr0 = -1, in
t attr1 = -1) { |
| 196 SkASSERT(NULL != effect); | 204 SkASSERT(NULL != effect); |
| 197 SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrEffectStage, (effect, attr0,
attr1)); | 205 SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrEffectStage, (effect, attr0,
attr1)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 } | 243 } |
| 236 | 244 |
| 237 ~AutoRestoreEffects() { this->set(NULL); } | 245 ~AutoRestoreEffects() { this->set(NULL); } |
| 238 | 246 |
| 239 void set(GrDrawState* ds); | 247 void set(GrDrawState* ds); |
| 240 | 248 |
| 241 bool isSet() const { return NULL != fDrawState; } | 249 bool isSet() const { return NULL != fDrawState; } |
| 242 | 250 |
| 243 private: | 251 private: |
| 244 GrDrawState* fDrawState; | 252 GrDrawState* fDrawState; |
| 253 SkAutoTUnref<GrEffectStage> fGeometryProcessor; |
| 245 int fColorEffectCnt; | 254 int fColorEffectCnt; |
| 246 int fCoverageEffectCnt; | 255 int fCoverageEffectCnt; |
| 247 }; | 256 }; |
| 248 | 257 |
| 249 /// @} | 258 /// @} |
| 250 | 259 |
| 251 /////////////////////////////////////////////////////////////////////////// | 260 /////////////////////////////////////////////////////////////////////////// |
| 252 /// @name Blending | 261 /// @name Blending |
| 253 //// | 262 //// |
| 254 | 263 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 /** Sets the draw state's matrix to identity. This can fail because the
current view matrix | 366 /** Sets the draw state's matrix to identity. This can fail because the
current view matrix |
| 358 is not invertible. */ | 367 is not invertible. */ |
| 359 bool setIdentity(GrDrawState* drawState); | 368 bool setIdentity(GrDrawState* drawState); |
| 360 | 369 |
| 361 private: | 370 private: |
| 362 void doEffectCoordChanges(const SkMatrix& coordChangeMatrix); | 371 void doEffectCoordChanges(const SkMatrix& coordChangeMatrix); |
| 363 | 372 |
| 364 GrDrawState* fDrawState; | 373 GrDrawState* fDrawState; |
| 365 SkMatrix fViewMatrix; | 374 SkMatrix fViewMatrix; |
| 366 int fNumColorStages; | 375 int fNumColorStages; |
| 376 bool fHasGeometryProcesso
r; |
| 367 SkAutoSTArray<8, GrEffectStage::SavedCoordChange> fSavedCoordChanges; | 377 SkAutoSTArray<8, GrEffectStage::SavedCoordChange> fSavedCoordChanges; |
| 368 }; | 378 }; |
| 369 | 379 |
| 370 /// @} | 380 /// @} |
| 371 | 381 |
| 372 /////////////////////////////////////////////////////////////////////////// | 382 /////////////////////////////////////////////////////////////////////////// |
| 373 /// @name Render Target | 383 /// @name Render Target |
| 374 //// | 384 //// |
| 375 | 385 |
| 376 /** | 386 /** |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 // Some of the auto restore objects assume that no effects are removed durin
g their lifetime. | 572 // Some of the auto restore objects assume that no effects are removed durin
g their lifetime. |
| 563 // This is used to assert that this condition holds. | 573 // This is used to assert that this condition holds. |
| 564 SkDEBUGCODE(int fBlockEffectRemovalCnt;) | 574 SkDEBUGCODE(int fBlockEffectRemovalCnt;) |
| 565 | 575 |
| 566 void internalSetVertexAttribs(const GrVertexAttrib attribs[], int count, siz
e_t stride); | 576 void internalSetVertexAttribs(const GrVertexAttrib attribs[], int count, siz
e_t stride); |
| 567 | 577 |
| 568 typedef GrRODrawState INHERITED; | 578 typedef GrRODrawState INHERITED; |
| 569 }; | 579 }; |
| 570 | 580 |
| 571 #endif | 581 #endif |
| OLD | NEW |