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