summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2021-06-03 14:03:01 +0300
committerMichael Meeks <michael.meeks@collabora.com>2021-06-03 16:40:49 +0200
commitd63f05764253990afbb3b39b3cf57922a25d2b2f (patch)
tree6c671e0aa8bb431ccffd0d5f0ae8778df01fa688 /sw
parent673bb150e81f0cafb03e0a537927d167f71e1e58 (diff)
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@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/swrect.hxx20
-rw-r--r--sw/source/core/bastyp/swrect.cxx20
2 files changed, 18 insertions, 22 deletions
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
{