Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/gpu/GrDrawState.h

Issue 12462008: Add GrEllipseEdgeEffect (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Cleaned up nits, adjusted some interfaces Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 const GrEffectRef* setEffect(int stageIdx, const GrEffectRef* effect, const int indices[]) {
492 fStages[stageIdx].setEffect(effect);
bsalomon 2013/03/07 15:59:13 Any reason not to move this code to StageEffect::s
jvanverth1 2013/03/07 22:00:44 Done.
493 int numVertexAttribs = (effect == NULL) ? 0 : effect->get()->numVertexAt tribs();
494 fStages[stageIdx].setVertexAttribIndices(indices, numVertexAttribs);
495 return effect;
496 }
497
491 /** 498 /**
492 * Creates a GrSimpleTextureEffect. 499 * Creates a GrSimpleTextureEffect.
493 */ 500 */
494 void createTextureEffect(int stageIdx, GrTexture* texture, const SkMatrix& m atrix) { 501 void createTextureEffect(int stageIdx, GrTexture* texture, const SkMatrix& m atrix) {
495 GrAssert(!this->getStage(stageIdx).getEffect()); 502 GrAssert(!this->getStage(stageIdx).getEffect());
496 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix); 503 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix);
497 this->setEffect(stageIdx, effect)->unref(); 504 this->setEffect(stageIdx, effect)->unref();
498 } 505 }
499 void createTextureEffect(int stageIdx, 506 void createTextureEffect(int stageIdx,
500 GrTexture* texture, 507 GrTexture* texture,
501 const SkMatrix& matrix, 508 const SkMatrix& matrix,
502 const GrTextureParams& params) { 509 const GrTextureParams& params) {
503 GrAssert(!this->getStage(stageIdx).getEffect()); 510 GrAssert(!this->getStage(stageIdx).getEffect());
504 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, par ams); 511 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, par ams);
505 this->setEffect(stageIdx, effect)->unref(); 512 this->setEffect(stageIdx, effect)->unref();
506 } 513 }
507 514
508 bool stagesDisabled() { 515 bool stagesDisabled() {
509 for (int i = 0; i < kNumStages; ++i) { 516 for (int i = 0; i < kNumStages; ++i) {
510 if (NULL != fStages[i].getEffect()) { 517 if (NULL != fStages[i].getEffect()) {
511 return false; 518 return false;
512 } 519 }
513 } 520 }
514 return true; 521 return true;
515 } 522 }
516 523
517 void disableStage(int stageIdx) { this->setEffect(stageIdx, NULL); } 524 void disableStage(int stageIdx) {
525 this->setEffect(stageIdx, NULL, NULL);
526 }
518 527
519 /** 528 /**
520 * Release all the GrEffects referred to by this draw state. 529 * Release all the GrEffects referred to by this draw state.
521 */ 530 */
522 void disableStages() { 531 void disableStages() {
523 for (int i = 0; i < kNumStages; ++i) { 532 for (int i = 0; i < kNumStages; ++i) {
524 this->disableStage(i); 533 this->disableStage(i);
525 } 534 }
526 } 535 }
527 536
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 components used). Coverage based on signed distance with negative 1023 components used). Coverage based on signed distance with negative
1015 being inside, positive outside. Edge specified in window space 1024 being inside, positive outside. Edge specified in window space
1016 (y-down) */ 1025 (y-down) */
1017 kQuad_EdgeType, 1026 kQuad_EdgeType,
1018 /* Same as above but for hairline quadratics. Uses unsigned distance. 1027 /* Same as above but for hairline quadratics. Uses unsigned distance.
1019 Coverage is min(0, 1-distance). */ 1028 Coverage is min(0, 1-distance). */
1020 kHairQuad_EdgeType, 1029 kHairQuad_EdgeType,
1021 /* Circle specified as center_x, center_y, outer_radius, inner_radius 1030 /* Circle specified as center_x, center_y, outer_radius, inner_radius
1022 all in window space (y-down). */ 1031 all in window space (y-down). */
1023 kCircle_EdgeType, 1032 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 1033
1028 kVertexEdgeTypeCnt 1034 kVertexEdgeTypeCnt
1029 }; 1035 };
1030 1036
1031 /** 1037 /**
1032 * Determines the interpretation per-vertex edge data when the 1038 * Determines the interpretation per-vertex edge data when the
1033 * kEdge_AttribBindingsBit is set (see GrDrawTarget). When per-vertex edges 1039 * kEdge_AttribBindingsBit is set (see GrDrawTarget). When per-vertex edges
1034 * are not specified the value of this setting has no effect. 1040 * are not specified the value of this setting has no effect.
1035 */ 1041 */
1036 void setVertexEdgeType(VertexEdgeType type) { 1042 void setVertexEdgeType(VertexEdgeType type) {
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 int fAttribIndices[kAttribIndexCount]; 1376 int fAttribIndices[kAttribIndexCount];
1371 GrVertexAttribArray<kVertexAttribCnt> fVertexAttribs; 1377 GrVertexAttribArray<kVertexAttribCnt> fVertexAttribs;
1372 GrEffectStage fStages[kNumStages]; 1378 GrEffectStage fStages[kNumStages];
1373 1379
1374 typedef GrRefCnt INHERITED; 1380 typedef GrRefCnt INHERITED;
1375 }; 1381 };
1376 1382
1377 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); 1383 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags);
1378 1384
1379 #endif 1385 #endif
OLDNEW
« src/gpu/GrContext.cpp ('K') | « src/gpu/GrContext.cpp ('k') | src/gpu/GrEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698