| 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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 | 481 |
| 482 /////////////////////////////////////////////////////////////////////////// | 482 /////////////////////////////////////////////////////////////////////////// |
| 483 /// @name Effect Stages | 483 /// @name Effect Stages |
| 484 //// | 484 //// |
| 485 | 485 |
| 486 const GrEffectRef* setEffect(int stageIdx, const GrEffectRef* effect) { | 486 const GrEffectRef* setEffect(int stageIdx, const GrEffectRef* effect) { |
| 487 fStages[stageIdx].setEffect(effect); | 487 fStages[stageIdx].setEffect(effect); |
| 488 return effect; | 488 return effect; |
| 489 } | 489 } |
| 490 | 490 |
| 491 void setEffectAttribIndices(int stageIdx, const int indices[], int count) { |
| 492 fStages[stageIdx].setVertexAttribIndices(indices, count); |
| 493 } |
| 494 |
| 491 /** | 495 /** |
| 492 * Creates a GrSimpleTextureEffect. | 496 * Creates a GrSimpleTextureEffect. |
| 493 */ | 497 */ |
| 494 void createTextureEffect(int stageIdx, GrTexture* texture, const SkMatrix& m
atrix) { | 498 void createTextureEffect(int stageIdx, GrTexture* texture, const SkMatrix& m
atrix) { |
| 495 GrAssert(!this->getStage(stageIdx).getEffect()); | 499 GrAssert(!this->getStage(stageIdx).getEffect()); |
| 496 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix); | 500 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix); |
| 497 this->setEffect(stageIdx, effect)->unref(); | 501 this->setEffect(stageIdx, effect)->unref(); |
| 498 } | 502 } |
| 499 void createTextureEffect(int stageIdx, | 503 void createTextureEffect(int stageIdx, |
| 500 GrTexture* texture, | 504 GrTexture* texture, |
| 501 const SkMatrix& matrix, | 505 const SkMatrix& matrix, |
| 502 const GrTextureParams& params) { | 506 const GrTextureParams& params) { |
| 503 GrAssert(!this->getStage(stageIdx).getEffect()); | 507 GrAssert(!this->getStage(stageIdx).getEffect()); |
| 504 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, par
ams); | 508 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, par
ams); |
| 505 this->setEffect(stageIdx, effect)->unref(); | 509 this->setEffect(stageIdx, effect)->unref(); |
| 506 } | 510 } |
| 507 | 511 |
| 508 bool stagesDisabled() { | 512 bool stagesDisabled() { |
| 509 for (int i = 0; i < kNumStages; ++i) { | 513 for (int i = 0; i < kNumStages; ++i) { |
| 510 if (NULL != fStages[i].getEffect()) { | 514 if (NULL != fStages[i].getEffect()) { |
| 511 return false; | 515 return false; |
| 512 } | 516 } |
| 513 } | 517 } |
| 514 return true; | 518 return true; |
| 515 } | 519 } |
| 516 | 520 |
| 517 void disableStage(int stageIdx) { this->setEffect(stageIdx, NULL); } | 521 void disableStage(int stageIdx) { |
| 522 this->setEffect(stageIdx, NULL); |
| 523 this->setEffectAttribIndices(stageIdx, NULL, 0); |
| 524 } |
| 518 | 525 |
| 519 /** | 526 /** |
| 520 * Release all the GrEffects referred to by this draw state. | 527 * Release all the GrEffects referred to by this draw state. |
| 521 */ | 528 */ |
| 522 void disableStages() { | 529 void disableStages() { |
| 523 for (int i = 0; i < kNumStages; ++i) { | 530 for (int i = 0; i < kNumStages; ++i) { |
| 524 this->disableStage(i); | 531 this->disableStage(i); |
| 525 } | 532 } |
| 526 } | 533 } |
| 527 | 534 |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 components used). Coverage based on signed distance with negative | 1021 components used). Coverage based on signed distance with negative |
| 1015 being inside, positive outside. Edge specified in window space | 1022 being inside, positive outside. Edge specified in window space |
| 1016 (y-down) */ | 1023 (y-down) */ |
| 1017 kQuad_EdgeType, | 1024 kQuad_EdgeType, |
| 1018 /* Same as above but for hairline quadratics. Uses unsigned distance. | 1025 /* Same as above but for hairline quadratics. Uses unsigned distance. |
| 1019 Coverage is min(0, 1-distance). */ | 1026 Coverage is min(0, 1-distance). */ |
| 1020 kHairQuad_EdgeType, | 1027 kHairQuad_EdgeType, |
| 1021 /* Circle specified as center_x, center_y, outer_radius, inner_radius | 1028 /* Circle specified as center_x, center_y, outer_radius, inner_radius |
| 1022 all in window space (y-down). */ | 1029 all in window space (y-down). */ |
| 1023 kCircle_EdgeType, | 1030 kCircle_EdgeType, |
| 1024 /* Axis-aligned ellipse specified as center_x, center_y, x_radius, x_rad
ius/y_radius | |
| 1025 all in window space (y-down). */ | |
| 1026 kEllipse_EdgeType, | |
| 1027 | 1031 |
| 1028 kVertexEdgeTypeCnt | 1032 kVertexEdgeTypeCnt |
| 1029 }; | 1033 }; |
| 1030 | 1034 |
| 1031 /** | 1035 /** |
| 1032 * Determines the interpretation per-vertex edge data when the | 1036 * Determines the interpretation per-vertex edge data when the |
| 1033 * kEdge_AttribBindingsBit is set (see GrDrawTarget). When per-vertex edges | 1037 * kEdge_AttribBindingsBit is set (see GrDrawTarget). When per-vertex edges |
| 1034 * are not specified the value of this setting has no effect. | 1038 * are not specified the value of this setting has no effect. |
| 1035 */ | 1039 */ |
| 1036 void setVertexEdgeType(VertexEdgeType type) { | 1040 void setVertexEdgeType(VertexEdgeType type) { |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 int fAttribIndices[kAttribIndexCount]; | 1374 int fAttribIndices[kAttribIndexCount]; |
| 1371 GrVertexAttribArray<kVertexAttribCnt> fVertexAttribs; | 1375 GrVertexAttribArray<kVertexAttribCnt> fVertexAttribs; |
| 1372 GrEffectStage fStages[kNumStages]; | 1376 GrEffectStage fStages[kNumStages]; |
| 1373 | 1377 |
| 1374 typedef GrRefCnt INHERITED; | 1378 typedef GrRefCnt INHERITED; |
| 1375 }; | 1379 }; |
| 1376 | 1380 |
| 1377 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); | 1381 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); |
| 1378 | 1382 |
| 1379 #endif | 1383 #endif |
| OLD | NEW |