aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-07-31 05:51:45 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-31 05:51:45 -0700
commit76cc6575a4c1fc46c426d61252233cd48990d10d (patch)
treebe9ead7f6eeba962b63e03da4099eb377b08ef6e
parenta9652ac09ee45b964e0d906887e1521ee328cb6a (diff)
Tweak the MaskFormat in one more place in GrBatchFontCache
-rw-r--r--src/gpu/GrAtlasTextContext.cpp3
-rw-r--r--src/gpu/GrBatchFontCache.h14
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.