From f9e12df94f7f4eacb1072415909b9c92be293130 Mon Sep 17 00:00:00 2001 From: Herb Derby Date: Mon, 26 Mar 2018 15:42:44 -0400 Subject: Cleanup SkAutoGlyphCache in SkXPSDevice. Change-Id: Iadd405fa527a8d3746d9f0b9ff803caaf1e582cf Reviewed-on: https://skia-review.googlesource.com/116524 Reviewed-by: Ben Wagner Commit-Queue: Herb Derby --- src/xps/SkXPSDevice.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'src/xps') diff --git a/src/xps/SkXPSDevice.cpp b/src/xps/SkXPSDevice.cpp index b8387b9206..2cfb545d4c 100644 --- a/src/xps/SkXPSDevice.cpp +++ b/src/xps/SkXPSDevice.cpp @@ -1875,9 +1875,10 @@ HRESULT SkXPSDevice::CreateTypefaceUse(const SkPaint& paint, 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 @@ void SkXPSDevice::drawText(const void* text, size_t byteLen, 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 @@ void SkXPSDevice::drawText(const void* text, size_t byteLen, SkFindAndPlaceGlyph::ProcessText( paint.getTextEncoding(), static_cast(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 @@ void SkXPSDevice::drawPosText(const void* text, size_t byteLen, 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 @@ void SkXPSDevice::drawPosText(const void* text, size_t byteLen, SkFindAndPlaceGlyph::ProcessPosText( paint.getTextEncoding(), static_cast(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; -- cgit v1.2.3