diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-08-13 16:44:15 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-08-16 15:53:02 +0200 |
commit | 581b2cf7960c48e6199bd35be839424113abe533 (patch) | |
tree | 5f5d0f4cf0be4d134804cea9738460e92a61e11c /tools | |
parent | 76f89b0097c02fa68c36cfc9a31de3b2e9166abc (diff) |
Drop tools::Rectangle::getX/getY, which are just duplicates of Left/Top
The change allowed to simplify many places where previously this API was
used, to avoid inefficient calculations (e.g., moving rectangle keeping
its size, and then immediately changing the size).
Change-Id: Ica2dc594d91cae83e2c2740c1f4fb23f44998916
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120461
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qa/cppunit/test_rectangle.cxx | 4 | ||||
-rw-r--r-- | tools/source/generic/gen.cxx | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/tools/qa/cppunit/test_rectangle.cxx b/tools/qa/cppunit/test_rectangle.cxx index b0bbf6ae1469..23bfaf61ec7a 100644 --- a/tools/qa/cppunit/test_rectangle.cxx +++ b/tools/qa/cppunit/test_rectangle.cxx @@ -47,8 +47,8 @@ void Test::test_rectangle() CPPUNIT_ASSERT_EQUAL(tools::Long(1), aRect.GetWidth()); CPPUNIT_ASSERT_EQUAL(tools::Long(1), aRect.GetHeight()); - // Annoyingly getWidth and getHeight returns the wrong size - // that was explicitly input. + // getWidth and getHeight return the size that excludes one of the bounds, + // unlike the ctor and GetWidth / GetHeight that operate on inclusive size CPPUNIT_ASSERT_EQUAL(tools::Long(0), aRect.getWidth()); CPPUNIT_ASSERT_EQUAL(tools::Long(0), aRect.getHeight()); diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index 5196ef0bd96e..abd32a208d70 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -193,7 +193,7 @@ OString tools::Rectangle::toString() const // Note that this is not just used for debugging output but the // format is parsed by external code (passed in callbacks to // LibreOfficeKit clients). So don't change. - return OString::number(getX()) + ", " + OString::number(getY()) + ", " + OString::number(getWidth()) + ", " + OString::number(getHeight()); + return OString::number(Left()) + ", " + OString::number(Top()) + ", " + OString::number(getWidth()) + ", " + OString::number(getHeight()); } void tools::Rectangle::expand(tools::Long nExpandBy) |