sw/source/core/view/viewimp.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
New commits: commit 586f51a9c64da28f0033bc40a9b88971efdc47a7 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Mon Jun 20 12:32:07 2022 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Jun 22 08:41:43 2022 +0200 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.lu...@collabora.com> Reviewed-by: Luboš Luňák <l.lu...@collabora.com> (cherry picked from commit a6b9fbfc15b9e1756ac8ea939b4c588e3f170c1d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136160 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index 1436cf152ba3..c8cacafca5ea 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -134,12 +134,13 @@ bool SwViewShellImp::AddPaintRect( const SwRect &rRect ) if(!m_pRegion->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_pRegion->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. @@ -149,7 +150,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_pRegion->pop_back(); return true; }