aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkCanvas.cpp
diff options
context:
space:
mode:
authorGravatar Herb Derby <herb@google.com>2018-06-04 15:49:15 -0400
committerGravatar Mike Klein <mtklein@chromium.org>2018-06-06 19:07:52 +0000
commit4ffa027cf6232ec7c314f6d81ff494fc0b5ccd42 (patch)
treea089748a5787adefdc14ca792fd188218cd18c47 /src/core/SkCanvas.cpp
parent975f8eeb447a9981977f7db715f95935ad583b70 (diff)
Smarter use of glyph cache
Change-Id: Ic9bea7310b375575503042881d9d54ff13996729 Reviewed-on: https://skia-review.googlesource.com/131924 Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/core/SkCanvas.cpp')
-rw-r--r--src/core/SkCanvas.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index dcff1b0cc3..4a6251f110 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -590,6 +590,8 @@ void SkCanvas::init(sk_sp<SkBaseDevice> device, InitFlags flags) {
device->androidFramework_setDeviceClipRestriction(&fClipRestrictionRect);
}
+
+ fScratchGlyphSet = skstd::make_unique<SkGlyphSet>();
}
SkCanvas::SkCanvas()
@@ -2448,7 +2450,7 @@ void SkCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkSca
while (iter.next()) {
auto glyphRun = SkGlyphRun::MakeFromDrawText(
- looper.paint(), text, byteLength, SkPoint::Make(x, y));
+ looper.paint(), text, byteLength, SkPoint::Make(x, y), fScratchGlyphSet.get());
iter.fDevice->drawGlyphRun(looper.paint(), &glyphRun);
}
@@ -2461,7 +2463,8 @@ void SkCanvas::onDrawPosText(const void* text, size_t byteLength, const SkPoint
LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
while (iter.next()) {
- auto glyphRun = SkGlyphRun::MakeFromDrawPosText(looper.paint(), text, byteLength, pos);
+ auto glyphRun = SkGlyphRun::MakeFromDrawPosText(
+ looper.paint(), text, byteLength, pos, fScratchGlyphSet.get());
iter.fDevice->drawGlyphRun(looper.paint(), &glyphRun);
}
@@ -2475,7 +2478,8 @@ void SkCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkScala
while (iter.next()) {
auto glyphRun =
- SkGlyphRun::MakeFromDrawPosTextH(looper.paint(), text, byteLength, xpos, constY);
+ SkGlyphRun::MakeFromDrawPosTextH(
+ looper.paint(), text, byteLength, xpos, constY, fScratchGlyphSet.get());
iter.fDevice->drawGlyphRun(looper.paint(), &glyphRun);
}