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
This commit is contained in:
tomhudson@google.com 2012-07-10 17:21:48 +00:00
parent 313f019287
commit 676e66096c
5 changed files with 11 additions and 6 deletions

View File

@ -446,7 +446,7 @@ void GrClipMaskManager::drawTexture(GrTexture* target,
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

View File

@ -1614,7 +1614,7 @@ void GrContext::setPaint(const GrPaint& paint) {
// 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);

View File

@ -225,14 +225,19 @@ public:
}
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);
}
}

View File

@ -226,6 +226,6 @@ void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture,
SK_Scalar1 * rect.fRight,
SK_Scalar1 * rect.fBottom);
target->drawRect(dstRect, NULL, stageMask, srcRects, NULL);
drawState->setTexture(kPathMaskStage, NULL);
drawState->disableStage(kPathMaskStage);
}

View File

@ -68,7 +68,7 @@ void GrTextContext::flushGlyphs() {
fMaxVertices = 0;
fCurrVertex = 0;
GrSafeSetNull(fCurrTexture);
drawState->setTexture(kGlyphMaskStage, NULL);
drawState->disableStage(kGlyphMaskStage);
}
}