diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-06-20 12:32:07 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-06-20 14:26:08 +0200 |
commit | a6b9fbfc15b9e1756ac8ea939b4c588e3f170c1d (patch) | |
tree | 00ad8d3aacdc2d0848dad04d0f16334490e8de67 /sw | |
parent | 54520bd1a01ff2e29bb92008778ebded8b2db9aa (diff) |
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>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/view/viewimp.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index 3b216a09b443..f44850d70f82 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -132,12 +132,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. @@ -147,7 +148,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; } |