aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-03-22 11:16:25 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-22 16:32:14 +0000
commit1a605cd396620d30a8f2b11bf57439fce5927a00 (patch)
treee8bec881bcbad2eb3290a82c7eed6b869905efa4
parentab46ac5ee801a048552425274804309eaaf9a805 (diff)
Remove the last uses of auto glyph cache.
Change-Id: I15fdc5bbe29aaa969fe6ec57010919b52249fd7f Reviewed-on: https://skia-review.googlesource.com/115886 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Herb Derby <herb@google.com>
-rw-r--r--src/pdf/SkPDFDevice.cpp4
-rw-r--r--src/pdf/SkPDFFont.cpp14
-rw-r--r--src/pdf/SkPDFFont.h4
3 files changed, 10 insertions, 12 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 58151ccdd4..2dbeda2c65 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -1432,7 +1432,7 @@ void SkPDFDevice::internalDrawText(
paint.setHinting(SkPaint::kNo_Hinting);
int emSize;
- SkAutoGlyphCache glyphCache = SkPDFFont::MakeVectorCache(typeface, &emSize);
+ auto glyphCache = SkPDFFont::MakeVectorCache(typeface, &emSize);
SkScalar textSize = paint.getTextSize();
SkScalar advanceScale = textSize * paint.getTextScaleX() / emSize;
@@ -1588,7 +1588,7 @@ void SkPDFDevice::internalDrawText(
scaledGlyphCachePaint.setTextScaleX(paint.getTextScaleX());
scaledGlyphCachePaint.setTextSkewX(paint.getTextSkewX());
scaledGlyphCachePaint.setTypeface(sk_ref_sp(typeface));
- SkAutoGlyphCache scaledGlyphCache(scaledGlyphCachePaint, nullptr, nullptr);
+ auto scaledGlyphCache = SkGlyphCache::FindOrCreateStrikeExclusive(scaledGlyphCachePaint);
SkTHashMap<SkPDFCanon::BitmapGlyphKey, SkPDFCanon::BitmapGlyph>* map =
&this->getCanon()->fBitmapGlyphImages;
for (PositionedGlyph positionedGlyph : fMissingGlyphs) {
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index 05bd3eb4d9..4937d913e7 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -6,7 +6,6 @@
*/
#include "SkData.h"
-#include "SkGlyphCache.h"
#include "SkMakeUnique.h"
#include "SkPDFCanon.h"
#include "SkPDFConvertType1FontStream.h"
@@ -26,7 +25,7 @@
#include "sample/chromium/font_subsetter.h"
#endif
-SkAutoGlyphCache SkPDFFont::MakeVectorCache(SkTypeface* face, int* size) {
+SkExclusiveStrikePtr SkPDFFont::MakeVectorCache(SkTypeface* face, int* size) {
SkPaint tmpPaint;
tmpPaint.setHinting(SkPaint::kNo_Hinting);
tmpPaint.setTypeface(sk_ref_sp(face));
@@ -39,9 +38,8 @@ SkAutoGlyphCache SkPDFFont::MakeVectorCache(SkTypeface* face, int* size) {
}
tmpPaint.setTextSize((SkScalar)unitsPerEm);
const SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
- SkAutoGlyphCache glyphCache(tmpPaint, &props, nullptr);
- SkASSERT(glyphCache.get());
- return glyphCache;
+ return SkGlyphCache::FindOrCreateStrikeExclusive(
+ tmpPaint, &props, SkScalerContextFlags::kFakeGammaAndBoostContrast, nullptr);
}
namespace {
@@ -459,7 +457,7 @@ void SkPDFType0Font::getFontSubset(SkPDFCanon* canon) {
int16_t defaultWidth = 0;
{
int emSize;
- SkAutoGlyphCache glyphCache = SkPDFFont::MakeVectorCache(face, &emSize);
+ auto glyphCache = SkPDFFont::MakeVectorCache(face, &emSize);
sk_sp<SkPDFArray> widths = SkPDFMakeCIDGlyphWidthsArray(
glyphCache.get(), &this->glyphUsage(), SkToS16(emSize), &defaultWidth);
if (widths && widths->size() > 0) {
@@ -535,7 +533,7 @@ static void populate_type_1_font(SkPDFDict* font,
font->insertInt("LastChar", (size_t)glyphCount);
{
int emSize;
- SkAutoGlyphCache glyphCache = SkPDFFont::MakeVectorCache(typeface, &emSize);
+ auto glyphCache = SkPDFFont::MakeVectorCache(typeface, &emSize);
auto widths = sk_make_sp<SkPDFArray>();
SkScalar advance = glyphCache->getGlyphIDAdvance(0).fAdvanceX;
widths->appendScalar(from_font_units(advance, SkToU16(emSize)));
@@ -630,7 +628,7 @@ static void add_type3_font_info(SkPDFCanon* canon,
--lastGlyphID;
}
int unitsPerEm;
- SkAutoGlyphCache cache = SkPDFFont::MakeVectorCache(typeface, &unitsPerEm);
+ auto cache = SkPDFFont::MakeVectorCache(typeface, &unitsPerEm);
SkScalar emSize = (SkScalar)unitsPerEm;
font->insertName("Subtype", "Type3");
// Flip about the x-axis and scale by 1/emSize.
diff --git a/src/pdf/SkPDFFont.h b/src/pdf/SkPDFFont.h
index 5639d87b67..44cebf9fef 100644
--- a/src/pdf/SkPDFFont.h
+++ b/src/pdf/SkPDFFont.h
@@ -11,11 +11,11 @@
#include "SkAdvancedTypefaceMetrics.h"
#include "SkBitSet.h"
+#include "SkGlyphCache.h"
#include "SkPDFTypes.h"
#include "SkTDArray.h"
#include "SkTypeface.h"
-class SkAutoGlyphCache;
class SkPDFCanon;
class SkPDFFont;
@@ -48,7 +48,7 @@ public:
type == SkAdvancedTypefaceMetrics::kTrueType_Font;
}
- static SkAutoGlyphCache MakeVectorCache(SkTypeface*, int* sizeOut);
+ static SkExclusiveStrikePtr MakeVectorCache(SkTypeface*, int* sizeOut);
/** Returns true if this font encoding supports glyph IDs above 255.
*/