diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp index c37affa939..dcd32ddffd 100644 --- a/src/gpu/GrClipMaskManager.cpp +++ b/src/gpu/GrClipMaskManager.cpp @@ -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 diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index f79249cf84..f756f8a348 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -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); diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h index 91327704cf..c07001c3a3 100644 --- a/src/gpu/GrDrawState.h +++ b/src/gpu/GrDrawState.h @@ -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); } } diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp index fe32110b83..317fd4142b 100644 --- a/src/gpu/GrSWMaskHelper.cpp +++ b/src/gpu/GrSWMaskHelper.cpp @@ -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); } diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp index 93ef23d9e1..daf48bf522 100644 --- a/src/gpu/GrTextContext.cpp +++ b/src/gpu/GrTextContext.cpp @@ -68,7 +68,7 @@ void GrTextContext::flushGlyphs() { fMaxVertices = 0; fCurrVertex = 0; GrSafeSetNull(fCurrTexture); - drawState->setTexture(kGlyphMaskStage, NULL); + drawState->disableStage(kGlyphMaskStage); } }