[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - sw/inc sw/source
Tor Lillqvist (via logerrit)
logerrit at kemper.freedesktop.org
Mon Oct 4 09:29:07 UTC 2021
sw/inc/swrect.hxx | 20 ++++++++++++++++++--
sw/source/core/bastyp/swrect.cxx | 20 --------------------
2 files changed, 18 insertions(+), 22 deletions(-)
New commits:
commit 83d00ef919805c32cc2559fa33a6db3e5214c5e2
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Thu Jun 3 14:03:01 2021 +0300
Commit: Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon Oct 4 11:28:31 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>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122917
Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
diff --git a/sw/inc/swrect.hxx b/sw/inc/swrect.hxx
index 23f69a490137..b41374e47bdc 100644
--- a/sw/inc/swrect.hxx
+++ b/sw/inc/swrect.hxx
@@ -96,9 +96,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, tools::Long nTolerance ) const;
- bool IsInside( const SwRect& rRect ) const;
+ bool IsInside( const SwRect& rRect ) const
+ {
+ const tools::Long nRight = Right();
+ const tools::Long nBottom = Bottom();
+ const tools::Long nrRight = rRect.Right();
+ const tools::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 eb178663897e..1da034d60ab1 100644
--- a/sw/source/core/bastyp/swrect.cxx
+++ b/sw/source/core/bastyp/swrect.cxx
@@ -75,26 +75,6 @@ SwRect& SwRect::Intersection_( const SwRect& rOther )
return *this;
}
-bool SwRect::IsInside( const SwRect& rRect ) const
-{
- const tools::Long nRight = Right();
- const tools::Long nBottom = Bottom();
- const tools::Long nrRight = rRect.Right();
- const tools::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, tools::Long nTolerance ) const
{
More information about the Libreoffice-commits
mailing list