Cleanup SkAutoGlyphCache in SkXPSDevice.
Change-Id: Iadd405fa527a8d3746d9f0b9ff803caaf1e582cf
Reviewed-on: https://skia-review.googlesource.com/116524
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/xps/SkXPSDevice.cpp b/src/xps/SkXPSDevice.cpp
index b8387b9..2cfb545 100644
--- a/src/xps/SkXPSDevice.cpp
+++ b/src/xps/SkXPSDevice.cpp
@@ -1875,9 +1875,10 @@
newTypefaceUse.ttcIndex = isTTC ? ttcIndex : -1;
newTypefaceUse.fontData = fontData;
newTypefaceUse.xpsFont = xpsFontResource.release();
-
- SkAutoGlyphCache agc(paint, &this->surfaceProps(), &SkMatrix::I());
- SkGlyphCache* glyphCache = agc.get();
+ auto glyphCache =
+ SkGlyphCache::FindOrCreateStrikeExclusive(
+ paint, &this->surfaceProps(),
+ SkScalerContextFlags::kNone, nullptr);
unsigned int glyphCount = glyphCache->getGlyphCount();
newTypefaceUse.glyphsUsed = new SkBitSet(glyphCount);
@@ -2061,10 +2062,10 @@
TypefaceUse* typeface;
HRV(CreateTypefaceUse(paint, &typeface));
- const SkMatrix& matrix = SkMatrix::I();
-
- SkAutoGlyphCache autoCache(paint, &this->surfaceProps(), &matrix);
- SkGlyphCache* cache = autoCache.get();
+ auto cache =
+ SkGlyphCache::FindOrCreateStrikeExclusive(
+ paint, &this->surfaceProps(),
+ SkScalerContextFlags::kNone, nullptr);
// Advance width and offsets for glyphs measured in hundredths of the font em size
// (XPS Spec 5.1.3).
@@ -2077,7 +2078,7 @@
SkFindAndPlaceGlyph::ProcessText(
paint.getTextEncoding(), static_cast<const char*>(text), byteLen,
- SkPoint{ x, y }, matrix, paint.getTextAlign(), cache, processOneGlyph);
+ SkPoint{ x, y }, SkMatrix::I(), paint.getTextAlign(), cache.get(), processOneGlyph);
if (xpsGlyphs.count() == 0) {
return;
@@ -2119,10 +2120,10 @@
TypefaceUse* typeface;
HRV(CreateTypefaceUse(paint, &typeface));
- const SkMatrix& matrix = SkMatrix::I();
-
- SkAutoGlyphCache autoCache(paint, &this->surfaceProps(), &matrix);
- SkGlyphCache* cache = autoCache.get();
+ auto cache =
+ SkGlyphCache::FindOrCreateStrikeExclusive(
+ paint, &this->surfaceProps(),
+ SkScalerContextFlags::kNone, nullptr);
// Advance width and offsets for glyphs measured in hundredths of the font em size
// (XPS Spec 5.1.3).
@@ -2135,7 +2136,8 @@
SkFindAndPlaceGlyph::ProcessPosText(
paint.getTextEncoding(), static_cast<const char*>(text), byteLen,
- offset, matrix, pos, scalarsPerPos, paint.getTextAlign(), cache, processOneGlyph);
+ offset, SkMatrix::I(), pos, scalarsPerPos, paint.getTextAlign(),
+ cache.get(), processOneGlyph);
if (xpsGlyphs.count() == 0) {
return;