summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-04-06 18:52:21 +0200
committerLuboš Luňák <l.lunak@collabora.com>2022-04-08 21:27:59 +0200
commit1b593dbc62dc2ceebc3f8be30d7221c916098f6d (patch)
tree2921d0a6f833e46605f093ae20d0b48e0fd7dd86 /vcl
parentea3f08b91d70587400011e7a34fd9df259542e85 (diff)
use vcl::text::TextLayoutCache in SalLayoutGlyphsCache
Change-Id: I0ec22fe53e05319dec15456a916b10e97ea91a75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132668 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/impglyphitem.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 3853691d7d00..eaf8cf5c8453 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -97,7 +97,8 @@ bool SalLayoutGlyphsImpl::IsValid() const
const SalLayoutGlyphs*
SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr<const OutputDevice> outputDevice, const OUString& text,
sal_Int32 nIndex, sal_Int32 nLen, const Point& rLogicPos,
- tools::Long nLogicWidth) const
+ tools::Long nLogicWidth,
+ const vcl::text::TextLayoutCache* layoutCache) const
{
if (nLen == 0)
return nullptr;
@@ -112,8 +113,15 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr<const OutputDevice> outputDevice, c
// So in that case this is a cached failure.
return nullptr;
}
- std::unique_ptr<SalLayout> layout = outputDevice->ImplLayout(
- text, nIndex, nLen, rLogicPos, nLogicWidth, {}, SalLayoutFlags::GlyphItemsOnly);
+ std::shared_ptr<const vcl::text::TextLayoutCache> tmpLayoutCache;
+ if (layoutCache == nullptr)
+ {
+ tmpLayoutCache = OutputDevice::CreateTextLayoutCache(text);
+ layoutCache = tmpLayoutCache.get();
+ }
+ std::unique_ptr<SalLayout> layout
+ = outputDevice->ImplLayout(text, nIndex, nLen, rLogicPos, nLogicWidth, {},
+ SalLayoutFlags::GlyphItemsOnly, layoutCache);
if (layout)
{
mCachedGlyphs.insert(std::make_pair(key, layout->GetGlyphs()));