tdf#89666: vcl: speed up HbLayoutEngine with cache in SwTxtFormatInfo

Desktop / LibreOffice - Michael Stahl [redhat.com] - 28 March 2015 10:34 UTC

When a SwTxtFormatInfo is created to format a paragraph, pre-compute the result of vcl::ScriptRun::next() and cache it for future calls to OutputDevice::GetTextBreak() and GetTextWidth().

This requires adapting a bunch of methods to pass the additional parameter, and some classes to backup and restore the cache when they replace the text of the SwTxtFormatInfo.

There is some code in vcl OutputDevice::ImplPrepareLayoutArgs() to modify the passed string and replace digits depending on "meTextLanguage" member; try to set it to the correct value when creating the layout cache (unfortunately it's not possible if the user sets the CTL Numerals config to the non-default "Context" value).

Another issue is the check in OutputDevice::ImplLayout() if there is a mpConversion member on the font; apparently this is used to translate between different Symbol fonts, so not very important; just ignore the cache in this case.

This reduces vcl::ScriptRun::next() from 11 to 0.36 billion callgrind cycles when built with GCC 4.9.2 -m32 -Os (which is still 16% of the formatting).

Change-Id: I61fb8530333f2e7a9199f767c00cf2181ba49951 Reviewed-on: https://gerrit.libreoffice.org/14732

1efe5fe tdf#89666: vcl: speed up HbLayoutEngine with cache in SwTxtFormatInfo
include/vcl/outdev.hxx | 20 +++++++----
sw/source/core/inc/drawfont.hxx | 16 +++++++--
sw/source/core/text/guess.cxx | 7 ++--
sw/source/core/text/inftxt.cxx | 35 +++++++++++++++----
sw/source/core/text/inftxt.hxx | 25 ++++++++++++--
sw/source/core/text/porfld.cxx | 4 +++
sw/source/core/text/pormulti.cxx | 3 ++
sw/source/core/txtnode/fntcache.cxx | 7 ++--
vcl/generic/glyphs/gcach_layout.cxx | 64 ++++++++++++++++++++++++++++++-----
vcl/inc/generic/glyphcache.hxx | 3 ++
vcl/inc/sallayout.hxx | 12 ++++++-
vcl/source/gdi/sallayout.cxx | 10 +++++-
vcl/source/outdev/text.cxx | 53 ++++++++++++++++++++++-------
13 files changed, 213 insertions(+), 46 deletions(-)

Upstream: cgit.freedesktop.org


  • Share