aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/xps/SkXPSDevice.cpp
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-03-26 15:42:44 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-26 21:00:44 +0000
commitf9e12df94f7f4eacb1072415909b9c92be293130 (patch)
treec0097a0536da7daf7e1886f4554d8f157e1a8f46 /src/xps/SkXPSDevice.cpp
parentf14e833392ed2bddcccc147a53a78d3b5a4ab769 (diff)
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>
Diffstat (limited to 'src/xps/SkXPSDevice.cpp')
-rw-r--r--src/xps/SkXPSDevice.cpp28
1 files changed, 15 insertions, 13 deletions
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<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 @@ 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<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;