From 6d4f6ffd38076361ede07d908f73306e5217409a Mon Sep 17 00:00:00 2001 From: caryclark Date: Mon, 13 Jun 2016 06:17:02 -0700 Subject: use pos text Use SkCanvas::drawPosText() to render the whole string rather than drawing glyphs one at a time. R=dsinclair@chromium.org Review-Url: https://codereview.chromium.org/2057343002 --- core/fxge/skia/fx_skia_device.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index 86a8269b79..6b2e2a2623 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -605,11 +605,16 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, m_pCanvas->save(); SkMatrix skMatrix = ToFlippedSkMatrix(*pObject2Device); m_pCanvas->concat(skMatrix); + SkTDArray positions; + positions.setCount(nChars); + SkTDArray glyphs; + glyphs.setCount(nChars); for (int index = 0; index < nChars; ++index) { const FXTEXT_CHARPOS& cp = pCharPos[index]; - uint16_t glyph = (uint16_t)cp.m_GlyphIndex; - m_pCanvas->drawText(&glyph, 2, cp.m_OriginX, cp.m_OriginY, paint); + positions[index] = {cp.m_OriginX, cp.m_OriginY}; + glyphs[index] = (uint16_t)cp.m_GlyphIndex; } + m_pCanvas->drawPosText(glyphs.begin(), nChars * 2, positions.begin(), paint); m_pCanvas->restore(); return TRUE; } -- cgit v1.2.3