Remove getter of writable GrEffectStage from GrDrawState.
Upcoming changes will require GrDrawState to know things about the set of installed effects. Thus all setting of effects must go through a GrDrawState function (setEffect()). This change accomplishes that.
Review URL: https://codereview.appspot.com/7214045
git-svn-id: http://skia.googlecode.com/svn/trunk@7411 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index ba9eb21..326df0b 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -185,16 +185,21 @@
/// @}
///////////////////////////////////////////////////////////////////////////
- /// @name Textures
+ /// @name Effect Stages
////
+ const GrEffectRef* setEffect(int stageIdx, const GrEffectRef* effect) {
+ fStages[stageIdx].setEffect(effect);
+ return effect;
+ }
+
/**
* Creates a GrSimpleTextureEffect.
*/
void createTextureEffect(int stageIdx, GrTexture* texture, const SkMatrix& matrix) {
GrAssert(!this->getStage(stageIdx).getEffect());
GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix);
- this->stage(stageIdx)->setEffect(effect)->unref();
+ this->setEffect(stageIdx, effect)->unref();
}
void createTextureEffect(int stageIdx,
GrTexture* texture,
@@ -202,7 +207,7 @@
const GrTextureParams& params) {
GrAssert(!this->getStage(stageIdx).getEffect());
GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, params);
- this->stage(stageIdx)->setEffect(effect)->unref();
+ this->setEffect(stageIdx, effect)->unref();
}
bool stagesDisabled() {
@@ -214,9 +219,7 @@
return true;
}
- void disableStage(int stageIdx) {
- fStages[stageIdx].setEffect(NULL);
- }
+ void disableStage(int stageIdx) { this->setEffect(stageIdx, NULL); }
/**
* Release all the GrEffects referred to by this draw state.
@@ -239,12 +242,6 @@
GrDrawState* fDrawState;
};
- /// @}
-
- ///////////////////////////////////////////////////////////////////////////
- /// @name Stages
- ////
-
/**
* Returns the current stage by index.
*/
@@ -254,14 +251,6 @@
}
/**
- * Writable pointer to a stage.
- */
- GrEffectStage* stage(int stageIdx) {
- GrAssert((unsigned)stageIdx < kNumStages);
- return fStages + stageIdx;
- }
-
- /**
* Called when the source coord system is changing. preConcat gives the transformation from the
* old coord system to the new coord system.
*/