| Index: src/gpu/GrBatchFontCache.h
|
| diff --git a/src/gpu/GrBatchFontCache.h b/src/gpu/GrBatchFontCache.h
|
| index f1c56ac00cc7f72ee8a5ae48e2d728da2b797eb4..f6617d0f74808a5f9672133052804b3ad8da01ef 100644
|
| --- a/src/gpu/GrBatchFontCache.h
|
| +++ b/src/gpu/GrBatchFontCache.h
|
| @@ -12,6 +12,7 @@
|
| #include "GrDrawTarget.h"
|
| #include "GrFontScaler.h"
|
| #include "GrGlyph.h"
|
| +#include "SkGlyph.h"
|
| #include "SkTDynamicHash.h"
|
| #include "SkVarAlloc.h"
|
|
|
| @@ -32,16 +33,36 @@ public:
|
| const GrFontDescKey* getFontScalerKey() const { return fFontScalerKey; }
|
| GrBatchFontCache* getBatchFontCache() const { return fBatchFontCache; }
|
|
|
| - inline GrGlyph* getGlyph(GrGlyph::PackedID packed, GrFontScaler* scaler) {
|
| + inline GrGlyph* getGlyph(const SkGlyph& skGlyph, GrGlyph::PackedID packed,
|
| + GrFontScaler* scaler) {
|
| GrGlyph* glyph = fCache.find(packed);
|
| if (NULL == glyph) {
|
| - glyph = this->generateGlyph(packed, scaler);
|
| + glyph = this->generateGlyph(skGlyph, packed, scaler);
|
| }
|
| return glyph;
|
| }
|
|
|
| - // returns true if glyph successfully added to texture atlas, false otherwise
|
| - bool addGlyphToAtlas(GrBatchTarget*, GrGlyph*, GrFontScaler*);
|
| + // 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.
|
| + // TODO we can handle some of these cases if we really want to, but the long term solution is to
|
| + // get the actual glyph image itself when we get the glyph metrics.
|
| + bool addGlyphToAtlas(GrBatchTarget*, GrGlyph*, GrFontScaler*, const SkGlyph&,
|
| + GrMaskFormat expectedMaskFormat);
|
|
|
| // testing
|
| int countGlyphs() const { return fCache.count(); }
|
| @@ -68,7 +89,7 @@ private:
|
| int fAtlasedGlyphs;
|
| bool fIsAbandoned;
|
|
|
| - GrGlyph* generateGlyph(GrGlyph::PackedID packed, GrFontScaler* scaler);
|
| + GrGlyph* generateGlyph(const SkGlyph&, GrGlyph::PackedID, GrFontScaler*);
|
|
|
| friend class GrBatchFontCache;
|
| };
|
|
|