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 /vcl/source/gdi | |
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 'vcl/source/gdi')
-rw-r--r-- | vcl/source/gdi/regband.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/region.cxx | 8 | ||||
-rw-r--r-- | vcl/source/gdi/regionband.cxx | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/vcl/source/gdi/regband.cxx b/vcl/source/gdi/regband.cxx index 64637dfd4e7c..675d99bc0975 100644 --- a/vcl/source/gdi/regband.cxx +++ b/vcl/source/gdi/regband.cxx @@ -799,7 +799,7 @@ void ImplRegionBand::XOr( tools::Long nXLeft, tools::Long nXRight ) OptimizeBand(); } -bool ImplRegionBand::IsInside( tools::Long nX ) +bool ImplRegionBand::Contains( tools::Long nX ) { ImplRegionBandSep* pSep = mpFirstSep; while ( pSep ) diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index 7acf33a53533..22f2c3acc885 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -1336,7 +1336,7 @@ const RegionBand* vcl::Region::GetAsRegionBand() const return getRegionBand(); } -bool vcl::Region::IsInside( const Point& rPoint ) const +bool vcl::Region::Contains( const Point& rPoint ) const { if(IsEmpty()) { @@ -1353,7 +1353,7 @@ bool vcl::Region::IsInside( const Point& rPoint ) const // Too expensive (?) //if(mpImplRegion->getRegionPolyPoly()) //{ - // return mpImplRegion->getRegionPolyPoly()->IsInside( rPoint ); + // return mpImplRegion->getRegionPolyPoly()->Contains( rPoint ); //} // ensure RegionBand existence @@ -1361,13 +1361,13 @@ bool vcl::Region::IsInside( const Point& rPoint ) const if(pRegionBand) { - return pRegionBand->IsInside(rPoint); + return pRegionBand->Contains(rPoint); } return false; } -bool vcl::Region::IsOver( const tools::Rectangle& rRect ) const +bool vcl::Region::Overlaps( const tools::Rectangle& rRect ) const { if(IsEmpty()) { diff --git a/vcl/source/gdi/regionband.cxx b/vcl/source/gdi/regionband.cxx index 31d942735d0b..e772d5b27c5b 100644 --- a/vcl/source/gdi/regionband.cxx +++ b/vcl/source/gdi/regionband.cxx @@ -1229,7 +1229,7 @@ void RegionBand::XOr(const RegionBand& rSource) } } -bool RegionBand::IsInside(const Point& rPoint) const +bool RegionBand::Contains(const Point& rPoint) const { // search band list @@ -1241,7 +1241,7 @@ bool RegionBand::IsInside(const Point& rPoint) const if((pBand->mnYTop <= rPoint.Y()) && (pBand->mnYBottom >= rPoint.Y())) { // is point within separation of the band? - return pBand->IsInside(rPoint.X()); + return pBand->Contains(rPoint.X()); } pBand = pBand->mpNextBand; |