aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/SkGlyphCacheBench.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'bench/SkGlyphCacheBench.cpp')
-rw-r--r--bench/SkGlyphCacheBench.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/bench/SkGlyphCacheBench.cpp b/bench/SkGlyphCacheBench.cpp
index c5e40af746..2e0429fce3 100644
--- a/bench/SkGlyphCacheBench.cpp
+++ b/bench/SkGlyphCacheBench.cpp
@@ -53,15 +53,18 @@ protected:
void onDraw(int loops, SkCanvas*) override {
size_t oldCacheLimitSize = SkGraphics::GetFontCacheLimit();
SkGraphics::SetFontCacheLimit(fCacheSize);
+ SkTypeface* typeface = sk_tool_utils::create_portable_typeface(
+ "serif", SkTypeface::kItalic);
SkPaint paint;
paint.setAntiAlias(true);
paint.setSubpixelText(true);
- paint.setTypeface(sk_tool_utils::create_portable_typeface("serif", SkTypeface::kItalic));
+ paint.setTypeface(typeface);
for (int work = 0; work < loops; work++) {
do_font_stuff(&paint);
}
SkGraphics::SetFontCacheLimit(oldCacheLimitSize);
+ SkSafeUnref(typeface);
}
private:
@@ -87,7 +90,7 @@ protected:
void onDraw(int loops, SkCanvas*) override {
size_t oldCacheLimitSize = SkGraphics::GetFontCacheLimit();
SkGraphics::SetFontCacheLimit(fCacheSize);
- sk_sp<SkTypeface> typefaces[] =
+ SkTypeface* typefaces[] =
{sk_tool_utils::create_portable_typeface("serif", SkTypeface::kItalic),
sk_tool_utils::create_portable_typeface("sans-serif", SkTypeface::kItalic)};
@@ -101,6 +104,8 @@ protected:
});
}
SkGraphics::SetFontCacheLimit(oldCacheLimitSize);
+ SkSafeUnref(typefaces[0]);
+ SkSafeUnref(typefaces[1]);
}
private: