Index: src/gpu/GrBitmapTextContext.cpp |
diff --git a/src/gpu/GrBitmapTextContext.cpp b/src/gpu/GrBitmapTextContext.cpp |
index 4f6a1af7b26b1f6967015e5d7da35ca66e258342..25c13ec8d1ae52ac34616e307bf68c1df42651cf 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; |
@@ -93,12 +94,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 |