[Libreoffice-commits] core.git: 2 commits - sd/source sw/source
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Wed Sep 8 08:31:36 UTC 2021
sd/source/ui/unoidl/unomodel.cxx | 24 ++++++++++++++++++++++++
sw/source/core/layout/layact.cxx | 11 ++++++++++-
2 files changed, 34 insertions(+), 1 deletion(-)
New commits:
commit 0f699173519176b9bd21761d553c34156c1ebd7d
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Tue Sep 7 13:02:14 2021 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Sep 8 10:31:17 2021 +0200
patch SdrPageWindow in SdXImpressDocument::paintTile()
This is based on commit 424312aa99307da9f0ee60ea6e3213b2b3dc26b4
amd I don't quite understand everything that happens, because
the drawing layer classes have all kinds of comments except those
that would explain the purpose or usage of the classes. My
understanding is that drawing layer keeps all kinds of state
in Sdr* classes and when drawing it tries to find those based
on the OutputDevice. But since tiled drawing uses its own
VirtualDevice for the drawing, the search fails and a temporary state
is used that's always setup up and cleared again. Which is wasteful,
and not having the state around also means that e.g. when clicking
a checkbox for impress master background, with idle painting
disabled there's nothing to react to the event and cause a tile
repaint.
Change-Id: Ic9036680c628d67615a82dcc4f585ab827b91525
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121780
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 54827450a64d..6c4f83244c74 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -57,6 +57,8 @@
#include <svx/svdundo.hxx>
#include <svx/unoapi.hxx>
#include <svx/unofill.hxx>
+#include <svx/sdrpagewindow.hxx>
+#include <svx/sdrpaintwindow.hxx>
#include <editeng/fontitem.hxx>
#include <toolkit/awt/vclxdevice.hxx>
#include <svx/svdpool.hxx>
@@ -2208,6 +2210,25 @@ void SdXImpressDocument::paintTile( VirtualDevice& rDevice,
if (!pViewSh)
return;
+ // Setup drawing layer to work properly. Since we use a custom VirtualDevice
+ // for the drawing, SdrPaintView::BeginCompleteRedraw() will call FindPaintWindow()
+ // unsuccessfully and use a temporary window that doesn't keep state. So patch
+ // the existing SdrPageWindow to use a temporary, and this way the state will be kept.
+ // Well, at least that's how I understand it based on Writer's RenderContextGuard,
+ // as the drawing layer classes lack documentation.
+ SdrPageWindow* patchedPageWindow = nullptr;
+ SdrPaintWindow* previousPaintWindow = nullptr;
+ std::unique_ptr<SdrPaintWindow> temporaryPaintWindow;
+ if(SdrView* pDrawView = pViewSh->GetDrawView())
+ {
+ if(SdrPageView* pSdrPageView = pDrawView->GetSdrPageView())
+ {
+ patchedPageWindow = pSdrPageView->FindPageWindow(*getDocWindow()->GetOutDev());
+ temporaryPaintWindow.reset(new SdrPaintWindow(*pDrawView, rDevice));
+ previousPaintWindow = patchedPageWindow->patchPaintWindow(*temporaryPaintWindow);
+ }
+ }
+
// Scaling. Must convert from pixels to twips. We know
// that VirtualDevices use a DPI of 96.
// We specifically calculate these scales first as we're still
@@ -2244,6 +2265,9 @@ void SdXImpressDocument::paintTile( VirtualDevice& rDevice,
LokChartHelper::PaintAllChartsOnTile(rDevice, nOutputWidth, nOutputHeight,
nTilePosX, nTilePosY, nTileWidth, nTileHeight);
+
+ if(patchedPageWindow != nullptr)
+ patchedPageWindow->unpatchPaintWindow(previousPaintWindow);
}
void SdXImpressDocument::selectPart(int nPart, int nSelect)
commit b9c2207e1b5247b4d3184b137be9a75a4b8c6c37
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Aug 9 12:44:40 2021 +0200
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Wed Sep 8 10:31:03 2021 +0200
avoid repeated writer layout calls with tiled rendering
My next commit will disable idle paints for tile rendering, as they
do nothing in that case (or at least that should be the case).
But this code causes an infinite loop with idle layout timer,
because painting resets the SwViewShellImp paint region, which is
not performed if painting is done only later by idle rendering.
Change-Id: Ic401f16254aade02ddb3e4faffd99f0ce29d4df4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120201
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 8bc306ee8505..2b689f10b52e 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -2261,7 +2261,16 @@ SwLayIdle::SwLayIdle( SwRootFrame *pRt, SwViewShellImp *pI ) :
{
--rSh.mnStartAction;
- if ( rSh.Imp()->GetRegion() )
+ // When using tiled rendering, idle painting is disabled and paints are done
+ // only later by tiled rendering. But paints call SwViewShellImp::DelRegion()
+ // to reset this GetRegion(), and if it's done too late,
+ // SwTiledRenderingTest::testTablePaintInvalidate() will end up in an infinite
+ // loop, because the idle layout will call this code repeatedly, because there
+ // will be no idle paints to reset GetRegion().
+ // This code dates back to the initial commit, and I find its purpose unclear,
+ // so I'm still leaving it here in case it turns out it serves a purpose.
+ static const bool blockOnRepaints = true;
+ if (!blockOnRepaints && rSh.Imp()->GetRegion())
bActions = true;
else
{
More information about the Libreoffice-commits
mailing list