Index: src/gpu/GrBitmapTextContext.cpp |
diff --git a/src/gpu/GrBitmapTextContext.cpp b/src/gpu/GrBitmapTextContext.cpp |
index 696077dd95d364d7e5f8bfafe5f03d1e80504e7c..a97c7cedfdb31ba9b1f788cad070589797237094 100755 |
--- a/src/gpu/GrBitmapTextContext.cpp |
+++ b/src/gpu/GrBitmapTextContext.cpp |
@@ -56,6 +56,7 @@ GrBitmapTextContext::GrBitmapTextContext(GrContext* context, |
fCurrTexture = NULL; |
fCurrVertex = 0; |
+ fEFfectTextureGenID = 0; |
fVertices = NULL; |
fMaxVertices = 0; |
@@ -95,12 +96,17 @@ void GrBitmapTextContext::flushGlyphs() { |
SkASSERT(fCurrTexture); |
GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNone_FilterMode); |
+ uint32_t textureGenID = fCurrTexture->getGenerationID(); |
+ |
+ if (textureGenID != fEFfectTextureGenID) { |
+ fCachedEffect.reset(GrCustomCoordsTextureEffect::Create(fCurrTexture, params)); |
+ fEFfectTextureGenID = textureGenID; |
+ } |
+ |
// This effect could be stored with one of the cache objects (atlas?) |
int coordsIdx = drawState->hasColorVertexAttribute() ? kGlyphCoordsWithColorAttributeIndex : |
kGlyphCoordsNoColorAttributeIndex; |
- drawState->addCoverageEffect( |
- GrCustomCoordsTextureEffect::Create(fCurrTexture, params), |
- coordsIdx)->unref(); |
+ drawState->addCoverageEffect(fCachedEffect.get(), coordsIdx); |
SkASSERT(NULL != fStrike); |
switch (fStrike->getMaskFormat()) { |
// Color bitmap text |