From 76cc6575a4c1fc46c426d61252233cd48990d10d Mon Sep 17 00:00:00 2001 From: joshualitt Date: Fri, 31 Jul 2015 05:51:45 -0700 Subject: [PATCH] Tweak the MaskFormat in one more place in GrBatchFontCache BUG=510931 Review URL: https://codereview.chromium.org/1268743002 --- src/gpu/GrAtlasTextContext.cpp | 3 ++- src/gpu/GrBatchFontCache.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp index f5867ba9cb..08fbf5887a 100644 --- a/src/gpu/GrAtlasTextContext.cpp +++ b/src/gpu/GrAtlasTextContext.cpp @@ -1673,7 +1673,8 @@ public: if (regenerateGlyphs) { // Get the id from the old glyph, and use the new strike to lookup // the glyph. - blob->fGlyphs[glyphOffset] = strike->getGlyph(skGlyph, id, scaler); + blob->fGlyphs[glyphOffset] = strike->getGlyph(skGlyph, id, maskFormat, + scaler); } glyph = blob->fGlyphs[glyphOffset]; SkASSERT(glyph); diff --git a/src/gpu/GrBatchFontCache.h b/src/gpu/GrBatchFontCache.h index 447fc3f991..998c220e8a 100644 --- a/src/gpu/GrBatchFontCache.h +++ b/src/gpu/GrBatchFontCache.h @@ -40,6 +40,20 @@ public: return glyph; } + // This variant of the above function is called by TextBatch. At this point, it is possible + // that the maskformat of the glyph differs from what we expect. In these cases we will just + // draw a clear square. + // skbug:4143 crbug:510931 + inline GrGlyph* getGlyph(const SkGlyph& skGlyph, GrGlyph::PackedID packed, + GrMaskFormat expectedMaskFormat, GrFontScaler* scaler) { + GrGlyph* glyph = fCache.find(packed); + if (NULL == glyph) { + glyph = this->generateGlyph(skGlyph, packed, scaler); + glyph->fMaskFormat = expectedMaskFormat; + } + return glyph; + } + // returns true if glyph successfully added to texture atlas, false otherwise. If the glyph's // mask format has changed, then addGlyphToAtlas will draw a clear box. This will almost never // happen. -- 2.34.1