More carefully disable stages in Ganesh to avoid textures or effects
leaking between draw calls.
http://codereview.appspot.com/6353083/
git-svn-id: http://skia.googlecode.com/svn/trunk@4510 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index c37affa..dcd32dd 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -446,7 +446,7 @@
fGpu->drawSimpleRect(rect, NULL, 1 << 0);
- drawState->setTexture(0, NULL);
+ drawState->disableStage(0);
}
// get a texture to act as a temporary buffer for AA clip boolean operations
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index f79249c..f756f8a 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1614,7 +1614,7 @@
// disable all stages not accessible via the paint
for (int s = GrPaint::kTotalStages; s < GrDrawState::kNumStages; ++s) {
- fDrawState->setTexture(s, NULL);
+ fDrawState->disableStage(s);
}
fDrawState->setColor(paint.fColor);
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index 9132770..c07001c 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -225,14 +225,19 @@
}
return true;
}
+
+ void disableStage(int index) {
+ GrSafeSetNull(fTextures[index]);
+ fSamplerStates[index].setCustomStage(NULL);
+ }
+
/**
* Release all the textures and custom stages referred to by this
* draw state.
*/
void disableStages() {
for (int i = 0; i < kNumStages; ++i) {
- GrSafeSetNull(fTextures[i]);
- fSamplerStates[i].setCustomStage(NULL);
+ this->disableStage(i);
}
}
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index fe32110..317fd41 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -226,6 +226,6 @@
SK_Scalar1 * rect.fRight,
SK_Scalar1 * rect.fBottom);
target->drawRect(dstRect, NULL, stageMask, srcRects, NULL);
- drawState->setTexture(kPathMaskStage, NULL);
+ drawState->disableStage(kPathMaskStage);
}
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 93ef23d..daf48bf 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -68,7 +68,7 @@
fMaxVertices = 0;
fCurrVertex = 0;
GrSafeSetNull(fCurrTexture);
- drawState->setTexture(kGlyphMaskStage, NULL);
+ drawState->disableStage(kGlyphMaskStage);
}
}