diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2021-09-17 21:49:21 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2021-09-20 12:10:44 +0200 |
commit | b22d4785310eac35696df771803dfba0871a50ac (patch) | |
tree | 56e394a3c38a2e1f17530fbc18dd8e6b3c5d5098 /sw/source/core/view | |
parent | 3e2370260f2b79c43b4f8a86b123861aa95d3ef2 (diff) |
clean up ambiguous confusing rectangle APIs like IsInside()
Reading 'rectA.IsInside( rectB )' kind of suggests that the code
checks whether 'rectA is inside rectB', but it's actually the other
way around. Rename IsInside() -> Contains(), IsOver() -> Overlaps(),
which should make it clear which way the logic goes.
Change-Id: I9347450fe7dc34c96df6d636a4e3e660de1801ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122271
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/source/core/view')
-rw-r--r-- | sw/source/core/view/pagepreviewlayout.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/view/vdraw.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/view/viewimp.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 28 |
4 files changed, 21 insertions, 21 deletions
diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx index 4a19062f4db6..1dac62197f13 100644 --- a/sw/source/core/view/pagepreviewlayout.cxx +++ b/sw/source/core/view/pagepreviewlayout.cxx @@ -879,7 +879,7 @@ struct PreviewPosInsidePagePred if ( _pPreviewPage->bVisible ) { tools::Rectangle aPreviewPageRect( _pPreviewPage->aPreviewWinPos, _pPreviewPage->aPageSize ); - return aPreviewPageRect.IsInside( mnPreviewPos ); + return aPreviewPageRect.Contains( mnPreviewPos ); } return false; } @@ -1058,7 +1058,7 @@ bool SwPagePreviewLayout::Paint(vcl::RenderContext& rRenderContext, const tools: aMapMode.SetOrigin( rpPreviewPage->aMapOffset ); pOutputDev->SetMapMode( aMapMode ); tools::Rectangle aPxPaintRect = pOutputDev->LogicToPixel( aPageRect ); - if ( aPxOutRect.IsOver( aPxPaintRect) ) + if ( aPxOutRect.Overlaps( aPxPaintRect) ) { const SwPageFrame* pPage = rpPreviewPage->pPage; @@ -1182,7 +1182,7 @@ void SwPagePreviewLayout::Repaint( const tools::Rectangle& rInvalidCoreRect ) co continue; tools::Rectangle aPageRect( rpPreviewPage->aLogicPos, rpPreviewPage->aPageSize ); - if ( rInvalidCoreRect.IsOver( aPageRect ) ) + if ( rInvalidCoreRect.Overlaps( aPageRect ) ) { aPageRect.Intersection(rInvalidCoreRect); tools::Rectangle aInvalidPreviewRect = aPageRect; diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx index ef739ec61768..37b6d67e58d6 100644 --- a/sw/source/core/view/vdraw.cxx +++ b/sw/source/core/view/vdraw.cxx @@ -188,7 +188,7 @@ bool SwViewShellImp::IsDragPossible( const Point &rPoint ) aRect.AddBottom( FUZZY_EDGE ); aRect.AddLeft (- FUZZY_EDGE ); aRect.AddRight ( FUZZY_EDGE ); - return aRect.IsInside( rPoint ); + return aRect.Contains( rPoint ); } void SwViewShellImp::NotifySizeChg( const Size &rNewSz ) @@ -257,7 +257,7 @@ void SwViewShellImp::NotifySizeChg( const Size &rNewSz ) } const tools::Rectangle aObjBound( pObj->GetCurrentBoundRect() ); - if ( !aDocRect.IsInside( aObjBound ) ) + if ( !aDocRect.Contains( aObjBound ) ) { Size aSz; if ( aObjBound.Left() > aDocRect.Right() ) diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx index 50304b384020..6f9492df7f4d 100644 --- a/sw/source/core/view/viewimp.cxx +++ b/sw/source/core/view/viewimp.cxx @@ -122,7 +122,7 @@ void SwViewShellImp::DelRegion() bool SwViewShellImp::AddPaintRect( const SwRect &rRect ) { // In case of tiled rendering the visual area is the last painted tile -> not interesting. - if ( rRect.IsOver( m_pShell->VisArea() ) || comphelper::LibreOfficeKit::isActive() ) + if ( rRect.Overlaps( m_pShell->VisArea() ) || comphelper::LibreOfficeKit::isActive() ) { if ( !m_pRegion ) { @@ -177,7 +177,7 @@ void SwViewShellImp::SetFirstVisPage(OutputDevice const * pRenderContext) SwPageFrame *pPage = static_cast<SwPageFrame*>(m_pShell->GetLayout()->Lower()); SwRect aPageRect = pPage->GetBoundRect(pRenderContext); - while ( pPage && !aPageRect.IsOver( m_pShell->VisArea() ) ) + while ( pPage && !aPageRect.Overlaps( m_pShell->VisArea() ) ) { pPage = static_cast<SwPageFrame*>(pPage->GetNext()); if ( pPage ) diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index c78ea43516b1..e80d07769f09 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -559,7 +559,7 @@ void SwViewShell::InvalidateWindows( const SwRect &rRect ) ::RepaintPagePreview( &rSh, rRect ); // In case of tiled rendering, invalidation is wanted even if // the rectangle is outside the visual area. - else if ( rSh.VisArea().IsOver( rRect ) || comphelper::LibreOfficeKit::isActive() ) + else if ( rSh.VisArea().Overlaps( rRect ) || comphelper::LibreOfficeKit::isActive() ) rSh.GetWin()->Invalidate( rRect.SVRect() ); } } @@ -574,7 +574,7 @@ const SwRect& SwViewShell::VisArea() const void SwViewShell::MakeVisible( const SwRect &rRect ) { - if ( !(!VisArea().IsInside( rRect ) || IsScrollMDI( this, rRect ) || GetCareDialog(*this)) ) + if ( !(!VisArea().Contains( rRect ) || IsScrollMDI( this, rRect ) || GetCareDialog(*this)) ) return; if ( IsViewLocked() ) @@ -1138,7 +1138,7 @@ void SwViewShell::VisPortChgd( const SwRect &rRect) } // #i9719# - consider new border and shadow width - if ( aPageRect.IsOver( aBoth ) ) + if ( aPageRect.Overlaps( aBoth ) ) { SwTwips nPageLeft = 0; SwTwips nPageRight = 0; @@ -1184,7 +1184,7 @@ void SwViewShell::VisPortChgd( const SwRect &rRect) tools::Rectangle aRect( aPrevArea.SVRect() ); aRect.SetLeft( nMinLeft ); aRect.SetRight( nMaxRight ); - if( VisArea().IsOver( aPrevArea ) && !mnLockPaint ) + if( VisArea().Overlaps( aPrevArea ) && !mnLockPaint ) { bScrolled = true; maVisArea.Pos() = aPrevArea.Pos(); @@ -1197,7 +1197,7 @@ void SwViewShell::VisPortChgd( const SwRect &rRect) } else if ( !mnLockPaint ) //will be released in Unlock { - if( VisArea().IsOver( aPrevArea ) ) + if( VisArea().Overlaps( aPrevArea ) ) { bScrolled = true; maVisArea.Pos() = aPrevArea.Pos(); @@ -1491,7 +1491,7 @@ void SwViewShell::PaintDesktop(vcl::RenderContext& rRenderContext, const SwRect const SwFrame *pPg = pRoot->Lower(); while ( pPg && pPg->GetNext() ) pPg = pPg->GetNext(); - if ( !pPg || !pPg->getFrameArea().IsOver( VisArea() ) ) + if ( !pPg || !pPg->getFrameArea().Overlaps( VisArea() ) ) bBorderOnly = true; } @@ -1546,7 +1546,7 @@ void SwViewShell::PaintDesktop(vcl::RenderContext& rRenderContext, const SwRect aPageRect.Pos().AdjustX( -(bSidebarRight ? 0 : nSidebarWidth) ); aPageRect.AddWidth(nSidebarWidth ); - if ( aPageRect.IsOver( rRect ) ) + if ( aPageRect.Overlaps( rRect ) ) aRegion -= aPageRect; pPage = pPage->GetNext(); @@ -1652,7 +1652,7 @@ bool SwViewShell::CheckInvalidForPaint( const SwRect &rRect ) for ( size_t i = 0; i < pRegion->size(); ++i ) { const SwRect &rTmp = (*pRegion)[i]; - bStop = rTmp.IsOver( VisArea() ); + bStop = rTmp.Overlaps( VisArea() ); if ( !bStop ) break; } @@ -1673,10 +1673,10 @@ bool SwViewShell::CheckInvalidForPaint( const SwRect &rRect ) SwRegionRects aRegion( rRect ); for ( size_t i = 0; i < pRegion->size(); ++i ) { const SwRect &rTmp = (*pRegion)[i]; - if ( !rRect.IsInside( rTmp ) ) + if ( !rRect.Contains( rTmp ) ) { InvalidateWindows( rTmp ); - if ( rTmp.IsOver( VisArea() ) ) + if ( rTmp.Overlaps( VisArea() ) ) { aRegion -= rTmp; bRet = true; } @@ -1764,7 +1764,7 @@ void SwViewShell::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang if ( Imp()->m_bSmoothUpdate ) { SwRect aTmp( rRect ); - if ( !Imp()->m_aSmoothRect.IsInside( aTmp ) ) + if ( !Imp()->m_aSmoothRect.Contains( aTmp ) ) Imp()->m_bStopSmooth = true; else { @@ -1811,7 +1811,7 @@ void SwViewShell::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang if ( IsPreview() ) { //When useful, process or destroy the old InvalidRect. - if ( aRect.IsInside( maInvalidRect ) ) + if ( aRect.Contains( maInvalidRect ) ) ResetInvalidRect(); SwViewShell::sbLstAct = true; GetLayout()->PaintSwFrame( rRenderContext, aRect ); @@ -1832,7 +1832,7 @@ void SwViewShell::Paint(vcl::RenderContext& rRenderContext, const tools::Rectang PaintDesktop(rRenderContext, aRect); //When useful, process or destroy the old InvalidRect. - if ( aRect.IsInside( maInvalidRect ) ) + if ( aRect.Contains( maInvalidRect ) ) ResetInvalidRect(); SwViewShell::sbLstAct = true; GetLayout()->PaintSwFrame( rRenderContext, aRect ); @@ -2592,7 +2592,7 @@ void SwViewShell::OnGraphicArrived(const SwRect& rRect) if(rShell.GetWin()) ::RepaintPagePreview(&rShell, rRect); } - else if(rShell.VisArea().IsOver(rRect) && OUTDEV_WINDOW == rShell.GetOut()->GetOutDevType()) + else if(rShell.VisArea().Overlaps(rRect) && OUTDEV_WINDOW == rShell.GetOut()->GetOutDevType()) { // invalidate instead of painting rShell.GetWin()->Invalidate(rRect.SVRect()); |