diff options
author | 2015-07-31 05:51:45 -0700 | |
---|---|---|
committer | 2015-07-31 05:51:45 -0700 | |
commit | 76cc6575a4c1fc46c426d61252233cd48990d10d (patch) | |
tree | be9ead7f6eeba962b63e03da4099eb377b08ef6e | |
parent | a9652ac09ee45b964e0d906887e1521ee328cb6a (diff) |
Tweak the MaskFormat in one more place in GrBatchFontCache
BUG=510931
Review URL: https://codereview.chromium.org/1268743002
-rw-r--r-- | src/gpu/GrAtlasTextContext.cpp | 3 | ||||
-rw-r--r-- | src/gpu/GrBatchFontCache.h | 14 |
2 files changed, 16 insertions, 1 deletions
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. |