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.cpp b/src/gpu/GrDrawState.cpp
index bdb1230..2d5c7aa 100644
--- a/src/gpu/GrDrawState.cpp
+++ b/src/gpu/GrDrawState.cpp
@@ -13,7 +13,9 @@
for (int i = 0; i < GrPaint::kMaxColorStages; ++i) {
int s = i + GrPaint::kFirstColorStage;
if (paint.isColorStageEnabled(i)) {
- *this->stage(s) = paint.getColorStage(i);
+ fStages[s] = paint.getColorStage(i);
+ } else {
+ fStages[s].setEffect(NULL);
}
}
@@ -22,7 +24,9 @@
for (int i = 0; i < GrPaint::kMaxCoverageStages; ++i) {
int s = i + GrPaint::kFirstCoverageStage;
if (paint.isCoverageStageEnabled(i)) {
- *this->stage(s) = paint.getCoverageStage(i);
+ fStages[s] = paint.getCoverageStage(i);
+ } else {
+ fStages[s].setEffect(NULL);
}
}
@@ -48,7 +52,7 @@
fDrawState->setViewMatrix(fViewMatrix);
for (int s = 0; s < GrDrawState::kNumStages; ++s) {
if (fRestoreMask & (1 << s)) {
- fDrawState->stage(s)->restoreCoordChange(fSavedCoordChanges[s]);
+ fDrawState->fStages[s].restoreCoordChange(fSavedCoordChanges[s]);
}
}
}
@@ -71,8 +75,8 @@
for (int s = 0; s < GrDrawState::kNumStages; ++s) {
if (!(explicitCoordStageMask & (1 << s)) && drawState->isStageEnabled(s)) {
fRestoreMask |= (1 << s);
- fDrawState->stage(s)->saveCoordChange(&fSavedCoordChanges[s]);
- drawState->stage(s)->preConcatCoordChange(preconcatMatrix);
+ fDrawState->fStages[s].saveCoordChange(&fSavedCoordChanges[s]);
+ drawState->fStages[s].preConcatCoordChange(preconcatMatrix);
}
}
}
@@ -84,7 +88,7 @@
fDrawState->setViewMatrix(fViewMatrix);
for (int s = 0; s < GrDrawState::kNumStages; ++s) {
if (fRestoreMask & (1 << s)) {
- fDrawState->stage(s)->restoreCoordChange(fSavedCoordChanges[s]);
+ fDrawState->fStages[s].restoreCoordChange(fSavedCoordChanges[s]);
}
}
}
@@ -117,7 +121,7 @@
inverted = true;
}
fRestoreMask |= (1 << s);
- GrEffectStage* stage = drawState->stage(s);
+ GrEffectStage* stage = drawState->fStages + s;
stage->saveCoordChange(&fSavedCoordChanges[s]);
stage->preConcatCoordChange(invVM);
}