diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2022-07-23 23:48:24 +1000 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2022-08-24 10:55:15 +0200 |
commit | 59210b075b79e4fc58f86542d9947d6ed0073abd (patch) | |
tree | af9f6c1a8d5de2d2ccde0e8671f9b320775a5f98 /include | |
parent | 51d2e734099e5c5c56393ef9f08007a7df441794 (diff) |
tools: rename Rectangle::Justify() to Rectangle::Normalize()
Jusify() normalizes the rectangle so both the Width and Height are
positive, without changing the location of the rectangle. It ensures
that the x and y coordinates will be moved to the top left of the
rectangle.
The name is strange, so renaming Justify() to Normalize().
Change-Id: Idbf163e65e52a798e38f785b8961b8042cf0cf2a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137379
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/tools/gen.hxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/include/tools/gen.hxx b/include/tools/gen.hxx index ea2c8de2c0e7..11d26b0372f2 100644 --- a/include/tools/gen.hxx +++ b/include/tools/gen.hxx @@ -361,7 +361,7 @@ public: bool Contains( tools::Long nIs ) const; - void Justify(); + void Normalize(); Pair const & toPair() const { return *this; } Pair & toPair() { return *this; } @@ -374,7 +374,7 @@ inline bool Range::Contains( tools::Long nIs ) const return ((mnA <= nIs) && (nIs <= mnB )); } -inline void Range::Justify() +inline void Range::Normalize() { if ( mnA > mnB ) std::swap(mnA, mnB); @@ -418,7 +418,7 @@ public: bool Contains( tools::Long nIs ) const; - void Justify(); + void Normalize(); bool operator !() const { return !Len(); } @@ -437,7 +437,7 @@ inline bool Selection::Contains( tools::Long nIs ) const return ((mnA <= nIs) && (nIs < mnB )); } -inline void Selection::Justify() +inline void Selection::Normalize() { if ( mnA > mnB ) std::swap(mnA, mnB); @@ -494,7 +494,7 @@ public: /// Constructs a closed interval rectangle constexpr Rectangle( const Point& rLT, const Size& rSize ); - constexpr inline static Rectangle Justify(const Point& rLT, const Point& rRB); + constexpr inline static Rectangle Normalize(const Point& rLT, const Point& rRB); constexpr tools::Long Left() const { return mnLeft; } constexpr tools::Long Right() const { return IsWidthEmpty() ? mnLeft : mnRight; } @@ -545,7 +545,7 @@ public: inline tools::Rectangle GetUnion( const tools::Rectangle& rRect ) const; inline tools::Rectangle GetIntersection( const tools::Rectangle& rRect ) const; - void Justify(); + void Normalize(); bool Contains( const Point& rPOINT ) const; bool Contains( const tools::Rectangle& rRect ) const; @@ -627,7 +627,7 @@ constexpr inline tools::Rectangle::Rectangle( const Point& rLT, const Size& rSiz , mnBottom(rSize.Height() ? mnTop + (rSize.Height() + (rSize.Height() > 0 ? -1 : 1)) : RECT_EMPTY) {} -constexpr inline tools::Rectangle tools::Rectangle::Justify(const Point& rLT, const Point& rRB) +constexpr inline tools::Rectangle tools::Rectangle::Normalize(const Point& rLT, const Point& rRB) { const std::pair<tools::Long, tools::Long> aLeftRight = std::minmax(rLT.X(), rRB.X()); const std::pair<tools::Long, tools::Long> aTopBottom = std::minmax(rLT.Y(), rRB.Y()); |