summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-06-20 12:32:07 +0200
committerCaolán McNamara <caolanm@redhat.com>2022-06-20 17:09:33 +0200
commitc0d9d30d8e2900c23b5d0ccac49064d2fb6650f3 (patch)
tree1ff152913c40840066942c1933f5aa71e7efb354
parenttdf#149639 Missing #include <stdint.h> in various external code (diff)
downloadcore-c0d9d30d8e2900c23b5d0ccac49064d2fb6650f3.tar.gz
core-c0d9d30d8e2900c23b5d0ccac49064d2fb6650f3.zip
fix SwViewShellImp::AddPaintRect() for sub-rects (tdf#146536)
Using just two corners to build the new resulting rect works only if the new rectangle actually really extends the previous one, but the <= means that this may compress also rects that are already contained in the previous rect, in which case it's necessary to make sure to use union to get the larger coordinate). Change-Id: Ie4303dfef903bded6d63625531e424a32cc01b06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136144 Tested-by: Luboš Luňák <l.lunak@collabora.com> Reviewed-by: Luboš Luňák <l.lunak@collabora.com> (cherry picked from commit a6b9fbfc15b9e1756ac8ea939b4c588e3f170c1d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136158 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/core/view/viewimp.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 854a9aaa03de..f08c3305e5d6 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -129,12 +129,13 @@ bool SwViewShellImp::AddPaintRect( const SwRect &rRect )
if(!m_pPaintRegion->empty())
{
// This function often gets called with rectangles that line up vertically.
- // Try to extend the last one downwards to include the new one.
+ // Try to extend the last one downwards to include the new one (use Union()
+ // in case the new one is actually already contained in the last one).
SwRect& last = m_pPaintRegion->back();
if(last.Left() == rRect.Left() && last.Width() == rRect.Width()
&& last.Bottom() + 1 >= rRect.Top() && last.Bottom() <= rRect.Bottom())
{
- last = SwRect( last.TopLeft(), rRect.BottomRight());
+ last.Union(rRect);
// And these rectangles lined up vertically often come up in groups
// that line up horizontally. Try to extend the previous rectangle
// to the right to include the last one.
@@ -144,7 +145,7 @@ bool SwViewShellImp::AddPaintRect( const SwRect &rRect )
if(last2.Top() == last.Top() && last2.Height() == last.Height()
&& last2.Right() + 1 >= last.Left() && last2.Right() <= last2.Right())
{
- last2 = SwRect( last2.TopLeft(), last.BottomRight());
+ last2.Union(last);
m_pPaintRegion->pop_back();
return true;
}