From 59210b075b79e4fc58f86542d9947d6ed0073abd Mon Sep 17 00:00:00 2001 From: Chris Sherlock Date: Sat, 23 Jul 2022 23:48:24 +1000 Subject: tools: rename Rectangle::Justify() to Rectangle::Normalize() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tools/source/generic/gen.cxx | 8 ++++---- tools/source/generic/poly.cxx | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'tools/source') diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index 0452f8ea2049..69dc4d068ced 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -99,10 +99,10 @@ tools::Rectangle& tools::Rectangle::Intersection( const tools::Rectangle& rRect return *this; } - // Justify rectangle + // Normalize rectangle tools::Rectangle aTmpRect( rRect ); - Justify(); - aTmpRect.Justify(); + Normalize(); + aTmpRect.Normalize(); // Perform intersection mnLeft = std::max( mnLeft, aTmpRect.mnLeft ); @@ -117,7 +117,7 @@ tools::Rectangle& tools::Rectangle::Intersection( const tools::Rectangle& rRect return *this; } -void tools::Rectangle::Justify() +void tools::Rectangle::Normalize() { if ((mnRight < mnLeft) && (!IsWidthEmpty())) { diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 25f15d5fd00a..2c12ad777ec1 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -121,7 +121,7 @@ ImplPolygon::ImplPolygon( const tools::Rectangle& rRect, sal_uInt32 nHorzRound, if ( !rRect.IsEmpty() ) { tools::Rectangle aRect( rRect ); - aRect.Justify(); // SJ: i9140 + aRect.Normalize(); // SJ: i9140 nHorzRound = std::min( nHorzRound, static_cast(std::abs( aRect.GetWidth() >> 1 )) ); nVertRound = std::min( nVertRound, static_cast(std::abs( aRect.GetHeight() >> 1 )) ); @@ -1443,9 +1443,9 @@ void Polygon::Clip( const tools::Rectangle& rRect ) // Use PolyPolygon::Clip(). assert( !HasFlags()); - // #105251# Justify rect before edge filtering + // #105251# Normalize rect before edge filtering tools::Rectangle aJustifiedRect( rRect ); - aJustifiedRect.Justify(); + aJustifiedRect.Normalize(); sal_uInt16 nSourceSize = mpImplPolygon->mnPoints; ImplPolygonPointFilter aPolygon( nSourceSize ); -- cgit