diff options
author | Armin Le Grand <armin.le.grand@me.com> | 2020-02-27 16:43:44 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2020-02-27 18:12:30 +0100 |
commit | 424312aa99307da9f0ee60ea6e3213b2b3dc26b4 (patch) | |
tree | be71b53596bccdba919059799f56bec0412fa101 /sw/source/core/view | |
parent | ab623953b92d82d615bd2af6a9369915fe6fb7a8 (diff) |
tdf#130768 Make tiled writer paint reuse decomposes
See more info in comment 23 of task. Roughly it's
about correcting a helper that led to destroying the
View and thus the OC and thus the whole primitive
buffering - what was expensive, for the case where
decompositions were expensive
Change-Id: Ic661ae810083a35812eaa923b439b3856b34b9ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89640
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'sw/source/core/view')
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index d2ae3da70e6b..555f17436b03 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -72,6 +72,8 @@ #include <vcl/svapp.hxx> #include <svx/sdrpaintwindow.hxx> #include <svx/sdr/overlay/overlaymanager.hxx> +#include <svx/sdrpagewindow.hxx> +#include <svx/svdpagv.hxx> #include <comphelper/lok.hxx> #include <sfx2/lokhelper.hxx> @@ -1715,35 +1717,47 @@ class RenderContextGuard VclPtr<vcl::RenderContext>& m_pRef; VclPtr<vcl::RenderContext> m_pOriginalValue; SwViewShell* m_pShell; + std::unique_ptr<SdrPaintWindow> m_TemporaryPaintWindow; + SdrPageWindow* m_pPatchedPageWindow; public: RenderContextGuard(VclPtr<vcl::RenderContext>& pRef, vcl::RenderContext* pValue, SwViewShell* pShell) : m_pRef(pRef), m_pOriginalValue(m_pRef), - m_pShell(pShell) + m_pShell(pShell), + m_TemporaryPaintWindow(), + m_pPatchedPageWindow(nullptr) { m_pRef = pValue; - if (pValue != m_pShell->GetWin() && m_pShell->Imp()->GetDrawView()) - m_pShell->Imp()->GetDrawView()->AddWindowToPaintView(pValue, m_pShell->GetWin()); - } - ~RenderContextGuard() - { - if (m_pRef != m_pShell->GetWin() && m_pShell->Imp()->GetDrawView()) + if (pValue != m_pShell->GetWin()) { - // Need to explicitly draw the overlay on m_pRef, since by default - // they would be only drawn for m_pOriginalValue. - SdrPaintWindow* pOldPaintWindow = m_pShell->Imp()->GetDrawView()->GetPaintWindow(0); - const rtl::Reference<sdr::overlay::OverlayManager>& xOldManager = pOldPaintWindow->GetOverlayManager(); - if (xOldManager.is()) + SdrView* pDrawView(m_pShell->Imp()->GetDrawView()); + + if (nullptr != pDrawView) { - if (SdrPaintWindow* pNewPaintWindow = m_pShell->Imp()->GetDrawView()->FindPaintWindow(*m_pRef)) - xOldManager->completeRedraw(pNewPaintWindow->GetRedrawRegion(), m_pRef); + SdrPageView* pSdrPageView(pDrawView->GetSdrPageView()); + + if (nullptr != pSdrPageView) + { + m_pPatchedPageWindow = pSdrPageView->FindPageWindow(*m_pShell->GetWin()); + + if (nullptr != m_pPatchedPageWindow) + { + m_TemporaryPaintWindow.reset(new SdrPaintWindow(*pDrawView, *pValue)); + m_pPatchedPageWindow->patchPaintWindow(*m_TemporaryPaintWindow); + } + } } + } + } - m_pShell->Imp()->GetDrawView()->DeleteWindowFromPaintView(m_pRef); + ~RenderContextGuard() + { + if(nullptr != m_pPatchedPageWindow) + { + m_pPatchedPageWindow->unpatchPaintWindow(); } - m_pRef = m_pOriginalValue; } }; } |