[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sw/inc sw/source
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jun 3 14:41:34 UTC 2021
sw/inc/swrect.hxx | 20 ++++++++++++++++++--
sw/source/core/bastyp/swrect.cxx | 20 --------------------
2 files changed, 18 insertions(+), 22 deletions(-)
New commits:
commit d63f05764253990afbb3b39b3cf57922a25d2b2f
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Jun 3 14:03:01 2021 +0300
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Jun 3 16:40:49 2021 +0200
Make the two SwRect::IsInside() functions inline
They show up in profiles so might give performance benefits when
compiled with optimisation.
Change-Id: I29a1442fac987819f06fa6dd9e92a3299b0637fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116662
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx
index 6cde3c3f01e7..abbc36292140 100644
--- a/sw/inc/swrect.hxx
+++ b/sw/inc/swrect.hxx
@@ -84,9 +84,25 @@ public:
// Same as Intersection, only assume that Rects are overlapping!
SwRect &Intersection_( const SwRect &rRect );
- bool IsInside( const Point& rPOINT ) const;
+ bool IsInside( const Point& rPoint ) const
+ {
+ return (Left() <= rPoint.X()) &&
+ (Top() <= rPoint.Y()) &&
+ (Right() >= rPoint.X()) &&
+ (Bottom()>= rPoint.Y());
+ }
bool IsNear(const Point& rPoint, long nTolerance ) const;
- bool IsInside( const SwRect& rRect ) const;
+ bool IsInside( const SwRect& rRect ) const
+ {
+ const long nRight = Right();
+ const long nBottom = Bottom();
+ const long nrRight = rRect.Right();
+ const long nrBottom= rRect.Bottom();
+ return (Left() <= rRect.Left()) && (rRect.Left()<= nRight) &&
+ (Left() <= nrRight) && (nrRight <= nRight) &&
+ (Top() <= rRect.Top()) && (rRect.Top() <= nBottom) &&
+ (Top() <= nrBottom) && (nrBottom <= nBottom);
+ }
bool IsOver( const SwRect& rRect ) const;
inline bool HasArea() const;
inline bool IsEmpty() const;
diff --git a/sw/source/core/bastyp/swrect.cxx b/sw/source/core/bastyp/swrect.cxx
index 884c155003e2..ab971bfd2a67 100644
--- a/sw/source/core/bastyp/swrect.cxx
+++ b/sw/source/core/bastyp/swrect.cxx
@@ -94,26 +94,6 @@ SwRect& SwRect::Intersection_( const SwRect& rRect )
return *this;
}
-bool SwRect::IsInside( const SwRect& rRect ) const
-{
- const long nRight = Right();
- const long nBottom = Bottom();
- const long nrRight = rRect.Right();
- const long nrBottom= rRect.Bottom();
- return (Left() <= rRect.Left()) && (rRect.Left()<= nRight) &&
- (Left() <= nrRight) && (nrRight <= nRight) &&
- (Top() <= rRect.Top()) && (rRect.Top() <= nBottom) &&
- (Top() <= nrBottom) && (nrBottom <= nBottom);
-}
-
-bool SwRect::IsInside( const Point& rPoint ) const
-{
- return (Left() <= rPoint.X()) &&
- (Top() <= rPoint.Y()) &&
- (Right() >= rPoint.X()) &&
- (Bottom()>= rPoint.Y());
-}
-
// mouse moving of table borders
bool SwRect::IsNear( const Point& rPoint, long nTolerance ) const
{
More information about the Libreoffice-commits
mailing list