diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-04-06 19:29:06 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-04-08 21:28:29 +0200 |
commit | 376a9792c32a51c91079a54a0cf190acd58485af (patch) | |
tree | c27cb8e19beae659d5b522163a5bc58c2e224e8a | |
parent | 94c2fb28d76c9c37849412a66b31d6861bce3155 (diff) |
use SalLayoutGlyphsCache in PDFWriterImpl
It's unlikely to repeatedly lay out the same strings often, so
it probably won't gain much, but still. If SalLayoutGlyphsCache
would work even on different OutputDevice pointers (that would
provide the same glyphs) then presumably this would be able
to reuse caching even from e.g. Writer.
Change-Id: Ib52d9ee92e950e69229497122df1789f5fc6b07e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132670
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r-- | vcl/inc/pdf/pdfwriter_impl.hxx | 3 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 12 |
2 files changed, 9 insertions, 6 deletions
diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx index b8bdc3825eee..69570fa84afb 100644 --- a/vcl/inc/pdf/pdfwriter_impl.hxx +++ b/vcl/inc/pdf/pdfwriter_impl.hxx @@ -53,6 +53,7 @@ #include <comphelper/hash.hxx> #include <tools/stream.hxx> #include <vcl/BinaryDataContainer.hxx> +#include <vcl/glyphitemcache.hxx> #include <vcl/filter/pdfobjectcontainer.hxx> #include <pdf/ExternalPDFStreams.hxx> @@ -764,6 +765,8 @@ private: ::comphelper::Hash m_DocDigest; + SalLayoutGlyphsCache m_layoutGlyphsCache; + /* variables for PDF security i12626 diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 40eab868a80a..65a0827ad68d 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -6499,9 +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::shared_ptr<const vcl::text::TextLayoutCache> layoutCache = CreateTextLayoutCache(rText); + const SalLayoutGlyphs* layoutGlyphs = m_layoutGlyphsCache.GetLayoutGlyphs( this, rText, nIndex, nLen, rPos ); std::unique_ptr<SalLayout> pLayout = ImplLayout( rText, nIndex, nLen, rPos, - 0, {}, SalLayoutFlags::NONE, layoutCache.get() ); + 0, {}, SalLayoutFlags::NONE, nullptr, layoutGlyphs ); if( pLayout ) { drawLayout( *pLayout, rText, bTextLines ); @@ -6516,9 +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::shared_ptr<const vcl::text::TextLayoutCache> layoutCache = CreateTextLayoutCache(rText); + const SalLayoutGlyphs* layoutGlyphs = m_layoutGlyphsCache.GetLayoutGlyphs( this, rText, nIndex, nLen, rPos, 0 ); std::unique_ptr<SalLayout> pLayout = ImplLayout( rText, nIndex, nLen, rPos, 0, pDXArray, - SalLayoutFlags::NONE, layoutCache.get() ); + SalLayoutFlags::NONE, nullptr, layoutGlyphs ); if( pLayout ) { drawLayout( *pLayout, rText, true ); @@ -6533,9 +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::shared_ptr<const vcl::text::TextLayoutCache> layoutCache = CreateTextLayoutCache(rText); + const SalLayoutGlyphs* layoutGlyphs = m_layoutGlyphsCache.GetLayoutGlyphs( this, rText, nIndex, nLen, rPos, nWidth ); std::unique_ptr<SalLayout> pLayout = ImplLayout( rText, nIndex, nLen, rPos, nWidth, - {}, SalLayoutFlags::NONE, layoutCache.get() ); + {}, SalLayoutFlags::NONE, nullptr, layoutGlyphs ); if( pLayout ) { drawLayout( *pLayout, rText, true ); |