Replace fixed-size array of effect stages in GrDrawState with two appendable arrays, one for color, one for coverage.
R=robertphillips@google.com
Review URL: https://codereview.chromium.org/16952006
git-svn-id: http://skia.googlecode.com/svn/trunk@9592 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 02bc8d7..1f3b630 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -387,14 +387,21 @@
}
GrAssert(NULL != drawState.getRenderTarget());
- for (int s = 0; s < GrDrawState::kNumStages; ++s) {
- if (drawState.isStageEnabled(s)) {
- const GrEffectRef& effect = *drawState.getStage(s).getEffect();
- int numTextures = effect->numTextures();
- for (int t = 0; t < numTextures; ++t) {
- GrTexture* texture = effect->texture(t);
- GrAssert(texture->asRenderTarget() != drawState.getRenderTarget());
- }
+
+ for (int s = 0; s < drawState.numColorStages(); ++s) {
+ const GrEffectRef& effect = *drawState.getColorStage(s).getEffect();
+ int numTextures = effect->numTextures();
+ for (int t = 0; t < numTextures; ++t) {
+ GrTexture* texture = effect->texture(t);
+ GrAssert(texture->asRenderTarget() != drawState.getRenderTarget());
+ }
+ }
+ for (int s = 0; s < drawState.numCoverageStages(); ++s) {
+ const GrEffectRef& effect = *drawState.getCoverageStage(s).getEffect();
+ int numTextures = effect->numTextures();
+ for (int t = 0; t < numTextures; ++t) {
+ GrTexture* texture = effect->texture(t);
+ GrAssert(texture->asRenderTarget() != drawState.getRenderTarget());
}
}
@@ -912,7 +919,7 @@
matrix.setTranslate(SkIntToScalar(srcRect.fLeft - dstPoint.fX),
SkIntToScalar(srcRect.fTop - dstPoint.fY));
matrix.postIDiv(tex->width(), tex->height());
- this->drawState()->createTextureEffect(0, tex, matrix);
+ this->drawState()->addColorTextureEffect(tex, matrix);
SkIRect dstRect = SkIRect::MakeXYWH(dstPoint.fX,
dstPoint.fY,
srcRect.width(),