vcl/source/gdi/pdfwriter_impl.cxx |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 47fe67de351dd4adbfe69247e0506d0766991813
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Mon Mar 14 16:03:03 2022 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Tue Mar 15 14:36:14 2022 +0100

    use CreateTextLayoutCache() in PDF export (tdf#116400)
    
    This seems to have a pretty good hit rate, avoiding most of the cost.
    
    Change-Id: Iccaf310acb796d4bc2056fabc24fa27a3631ab18
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131557
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 6477163c1b78..fc15be2be7bb 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -6499,7 +6499,9 @@ void PDFWriterImpl::drawText( const Point& rPos, const 
OUString& rText, sal_Int3
 
     // get a layout from the OutputDevice's SalGraphics
     // this also enforces font substitution and sets the font on SalGraphics
-    std::unique_ptr<SalLayout> pLayout = ImplLayout( rText, nIndex, nLen, rPos 
);
+    std::shared_ptr<const vcl::text::TextLayoutCache> layoutCache = 
CreateTextLayoutCache(rText);
+    std::unique_ptr<SalLayout> pLayout = ImplLayout( rText, nIndex, nLen, rPos,
+        0, {}, SalLayoutFlags::NONE, layoutCache.get() );
     if( pLayout )
     {
         drawLayout( *pLayout, rText, bTextLines );
@@ -6514,7 +6516,9 @@ void PDFWriterImpl::drawTextArray( const Point& rPos, 
const OUString& rText, o3t
 
     // get a layout from the OutputDevice's SalGraphics
     // this also enforces font substitution and sets the font on SalGraphics
-    std::unique_ptr<SalLayout> pLayout = ImplLayout( rText, nIndex, nLen, 
rPos, 0, pDXArray );
+    std::shared_ptr<const vcl::text::TextLayoutCache> layoutCache = 
CreateTextLayoutCache(rText);
+    std::unique_ptr<SalLayout> pLayout = ImplLayout( rText, nIndex, nLen, 
rPos, 0, pDXArray,
+        SalLayoutFlags::NONE, layoutCache.get() );
     if( pLayout )
     {
         drawLayout( *pLayout, rText, true );
@@ -6529,7 +6533,9 @@ void PDFWriterImpl::drawStretchText( const Point& rPos, 
sal_uLong nWidth, const
 
     // get a layout from the OutputDevice's SalGraphics
     // this also enforces font substitution and sets the font on SalGraphics
-    std::unique_ptr<SalLayout> pLayout = ImplLayout( rText, nIndex, nLen, 
rPos, nWidth );
+    std::shared_ptr<const vcl::text::TextLayoutCache> layoutCache = 
CreateTextLayoutCache(rText);
+    std::unique_ptr<SalLayout> pLayout = ImplLayout( rText, nIndex, nLen, 
rPos, nWidth,
+        {}, SalLayoutFlags::NONE, layoutCache.get() );
     if( pLayout )
     {
         drawLayout( *pLayout, rText, true );

Reply via email to