summaryrefslogtreecommitdiff
path: root/sw/source/core/view
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-09-17 00:22:49 +0200
committerLuboš Luňák <l.lunak@collabora.com>2021-09-19 09:32:48 +0200
commit5a3c60f7c76fc0eca21f0fd468783e0ae48e3129 (patch)
tree807867659a2d1b3cbefac65d6753db471d36fee1 /sw/source/core/view
parentbc09e2c08f9db85c8f1cbd9c0e71e3e60d6d6ed3 (diff)
do not double-invert SwRegionRects
The usual way to use SwRegionRects seems to be to set it to the full area (origin) and then use operator-= to remove parts. But operator-= is slower than operator+=, so if that all is followed by Invert() and Compress(), it's essentially inverting the operation twice, making it both slower and (IMO) more complicated. Make it possible to simply use operator+=, collect all rectangles and then post-process once using LimitToOrigin()+Compress(). I'm not entirely happy about the SwRegionRects constructor, but I don't have a better idea that wouldn't silently break backwards compatibility for backporting. Change-Id: If3c83e32729e5d02b9d97b66c93fac04d4fb3ecc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122215 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sw/source/core/view')
-rw-r--r--sw/source/core/view/viewimp.cxx5
-rw-r--r--sw/source/core/view/viewsh.cxx7
2 files changed, 5 insertions, 7 deletions
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 16657bb0849a..50304b384020 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -129,9 +129,10 @@ bool SwViewShellImp::AddPaintRect( const SwRect &rRect )
// In case of normal rendering, this makes sure only visible rectangles are painted.
// Otherwise get the rectangle of the full document, so all paint rectangles are invalidated.
const SwRect& rArea = comphelper::LibreOfficeKit::isActive() ? m_pShell->GetLayout()->getFrameArea() : m_pShell->VisArea();
- m_pRegion.reset(new SwRegionRects(rArea));
+ m_pRegion.reset(new SwRegionRects);
+ m_pRegion->ChangeOrigin(rArea);
}
- (*m_pRegion) -= rRect;
+ (*m_pRegion) += rRect;
return true;
}
return false;
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 0670e8e102b4..c78ea43516b1 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -329,9 +329,7 @@ void SwViewShell::ImplEndAction( const bool bIdleEnd )
{
SwRootFrame* pCurrentLayout = GetLayout();
- //First Invert then Compress, never the other way round!
- pRegion->Invert();
-
+ pRegion->LimitToOrigin();
pRegion->Compress();
ScopedVclPtr<VirtualDevice> pVout;
@@ -1667,8 +1665,7 @@ bool SwViewShell::CheckInvalidForPaint( const SwRect &rRect )
if ( pRegion )
{
- //First Invert then Compress, never the other way round!
- pRegion->Invert();
+ pRegion->LimitToOrigin();
pRegion->Compress();
bRet = false;
if ( !pRegion->empty() )