svx/source/inc/StylesPreviewWindow.hxx | 2 ++ svx/source/tbxctrls/StylesPreviewWindow.cxx | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-)
New commits: commit 1f7703febb182a0542522b3403740d526c575abd Author: Luboš Luňák <[email protected]> AuthorDate: Fri Mar 11 17:48:21 2022 +0100 Commit: Luboš Luňák <[email protected]> CommitDate: Tue Mar 15 19:43:04 2022 +0100 use SalLayoutGlyphsCache in StyleItemController::DrawText() This may get called very often during document import (e.g. during pasting in some cases, such as between Online windows, the backtrace is roughly SwTransferable::PasteOLE() -> SwReader::Read() -> ... -> SwDocStyleSheet::SetParent() and then a broadcast that's listened to by this code). And StylesPreviewWindow_Base::UpdateStylesList() gets called on every such occassion. Change-Id: I15e7e0509cd6ea56e1e0aab07c8c9739201ed9b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131391 Tested-by: Jenkins Reviewed-by: Luboš Luňák <[email protected]> diff --git a/svx/source/inc/StylesPreviewWindow.hxx b/svx/source/inc/StylesPreviewWindow.hxx index 3b652dcfb0d0..b59ad94041e7 100644 --- a/svx/source/inc/StylesPreviewWindow.hxx +++ b/svx/source/inc/StylesPreviewWindow.hxx @@ -24,6 +24,7 @@ #include <svl/style.hxx> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <sfx2/sfxstatuslistener.hxx> +#include <vcl/glyphitemcache.hxx> class StylesPreviewWindow_Base; @@ -59,6 +60,7 @@ class StyleItemController SfxStyleFamily m_eStyleFamily; std::pair<OUString, OUString> m_aStyleName; + SalLayoutGlyphsCache m_GlyphsCache; public: StyleItemController(const std::pair<OUString, OUString>& aStyleName); diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx index ba338ffb22bc..8996b0083628 100644 --- a/svx/source/tbxctrls/StylesPreviewWindow.cxx +++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx @@ -340,14 +340,16 @@ void StyleItemController::DrawHighlight(vcl::RenderContext& rRenderContext, Colo void StyleItemController::DrawText(vcl::RenderContext& rRenderContext) { + const SalLayoutGlyphs* layoutGlyphs + = m_GlyphsCache.GetLayoutGlyphs(&rRenderContext, m_aStyleName.second); tools::Rectangle aTextRect; - rRenderContext.GetTextBoundRect(aTextRect, m_aStyleName.second); + rRenderContext.GetTextBoundRect(aTextRect, m_aStyleName.second, 0, 0, -1, 0, {}, layoutGlyphs); Point aPos(0, 0); aPos.AdjustX(LEFT_MARGIN); aPos.AdjustY((rRenderContext.GetOutputHeightPixel() - aTextRect.Bottom()) / 2); - rRenderContext.DrawText(aPos, m_aStyleName.second); + rRenderContext.DrawText(aPos, m_aStyleName.second, 0, -1, nullptr, nullptr, layoutGlyphs); } StylesPreviewWindow_Base::StylesPreviewWindow_Base(
