sw/source/core/view/viewsh.cxx | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
New commits: commit b28fdc6b412c30b2d16c622483be4e6ee1359121 Author: Sohrab Kazak <sohrab.ka...@gmail.com> AuthorDate: Sun Aug 18 20:43:20 2024 -0700 Commit: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> CommitDate: Sun Sep 1 16:07:29 2024 +0200 tdf#145538 tdf#153109 Use all_of / range-based for loops Change-Id: I7717c85fa55083794b07433e0b0807424cf7f39e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172221 Tested-by: Jenkins Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> Tested-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index d0ccaaa46a50..be915f99ba31 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -1805,15 +1805,10 @@ bool SwViewShell::CheckInvalidForPaint( const SwRect &rRect ) if ( oRegion && aAction.IsBrowseActionStop() ) { //only of interest when something has changed in the visible range - bool bStop = true; - for ( size_t i = 0; i < oRegion->size(); ++i ) - { - const SwRect &rTmp = (*oRegion)[i]; - bStop = rTmp.Overlaps( VisArea() ); - if ( !bStop ) - break; - } - if ( bStop ) + bool bAllNoOverlap = std::all_of(oRegion->begin(), oRegion->end(), [this](const SwRect &rTmp) { + return rTmp.Overlaps( VisArea() ); + }); + if ( bAllNoOverlap ) oRegion.reset(); } @@ -1825,8 +1820,8 @@ bool SwViewShell::CheckInvalidForPaint( const SwRect &rRect ) if ( !oRegion->empty() ) { SwRegionRects aRegion( rRect ); - for ( size_t i = 0; i < oRegion->size(); ++i ) - { const SwRect &rTmp = (*oRegion)[i]; + for ( const SwRect &rTmp : *oRegion ) + { if ( !rRect.Contains( rTmp ) ) { InvalidateWindows( rTmp );