Convert GrGlyph::PackedID to SkPackedGlyphID
This changes ripples through many areas of the code like the
hash map.
This will simplify making SkGlyphCache and GrTextStrike work
together in future CLs.
* Convert ctor to take an SkGlyph
* Remove many unused functions
Change-Id: I43ea414f03dfbb683ba7b46bf48a93c7a78895c6
Reviewed-on: https://skia-review.googlesource.com/c/179641
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/text/GrGlyphCache.h b/src/gpu/text/GrGlyphCache.h
index 835d484..585570c 100644
--- a/src/gpu/text/GrGlyphCache.h
+++ b/src/gpu/text/GrGlyphCache.h
@@ -31,8 +31,7 @@
GrTextStrike(const SkDescriptor& fontScalerKey);
GrGlyph* getGlyph(const SkGlyph& skGlyph) {
- GrGlyph::PackedID packed = GrGlyph::FromSkGlyph(skGlyph);
- GrGlyph* glyph = fCache.find(packed);
+ GrGlyph* glyph = fCache.find(skGlyph.getPackedID());
if (!glyph) {
glyph = this->generateGlyph(skGlyph);
}
@@ -43,7 +42,7 @@
// 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
- GrGlyph* getGlyph(GrGlyph::PackedID packed,
+ GrGlyph* getGlyph(SkPackedGlyphID packed,
SkGlyphCache* cache) {
GrGlyph* glyph = fCache.find(packed);
if (!glyph) {
@@ -82,17 +81,15 @@
static uint32_t Hash(const SkDescriptor& desc) { return desc.getChecksum(); }
private:
- SkTDynamicHash<GrGlyph, GrGlyph::PackedID> fCache;
+ SkTDynamicHash<GrGlyph, SkPackedGlyphID> fCache;
SkAutoDescriptor fFontScalerKey;
SkArenaAlloc fAlloc{512};
int fAtlasedGlyphs{0};
bool fIsAbandoned{false};
- static const SkGlyph& GrToSkGlyph(SkGlyphCache* cache, GrGlyph::PackedID id) {
- return cache->getGlyphIDMetrics(GrGlyph::UnpackID(id),
- GrGlyph::UnpackFixedX(id),
- GrGlyph::UnpackFixedY(id));
+ static const SkGlyph& GrToSkGlyph(SkGlyphCache* cache, SkPackedGlyphID id) {
+ return cache->getGlyphIDMetrics(id.code(), id.getSubXFixed(), id.getSubYFixed());
}
GrGlyph* generateGlyph(const SkGlyph&);