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 /vcl/backendtest/outputdevice | |
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 'vcl/backendtest/outputdevice')
-rw-r--r-- | vcl/backendtest/outputdevice/clip.cxx | 9 | ||||
-rw-r--r-- | vcl/backendtest/outputdevice/common.cxx | 4 | ||||
-rw-r--r-- | vcl/backendtest/outputdevice/line.cxx | 11 |
3 files changed, 11 insertions, 13 deletions
diff --git a/vcl/backendtest/outputdevice/clip.cxx b/vcl/backendtest/outputdevice/clip.cxx index 86064b583610..495b43b6f11f 100644 --- a/vcl/backendtest/outputdevice/clip.cxx +++ b/vcl/backendtest/outputdevice/clip.cxx @@ -58,11 +58,10 @@ Bitmap OutputDeviceTestClip::setupClipB2DPolyPolygon() tools::Rectangle rectangle = maVDRectangle; rectangle.shrink(2); mpVirtualDevice->SetClipRegion(vcl::Region(basegfx::B2DPolyPolygon(basegfx::B2DPolygon{ - basegfx::B2DPoint(rectangle.getX(), rectangle.getY()), - basegfx::B2DPoint(rectangle.getX(), rectangle.getY() + rectangle.getHeight()), - basegfx::B2DPoint(rectangle.getX() + rectangle.getWidth(), - rectangle.getY() + rectangle.getHeight()), - basegfx::B2DPoint(rectangle.getX() + rectangle.getWidth(), rectangle.getY()), + basegfx::B2DPoint(rectangle.Left(), rectangle.Top()), + basegfx::B2DPoint(rectangle.Left(), rectangle.Bottom()), + basegfx::B2DPoint(rectangle.Right(), rectangle.Bottom()), + basegfx::B2DPoint(rectangle.Right(), rectangle.Top()), }))); mpVirtualDevice->SetBackground(constFillColor); mpVirtualDevice->Erase(maVDRectangle); diff --git a/vcl/backendtest/outputdevice/common.cxx b/vcl/backendtest/outputdevice/common.cxx index 8286488fccf2..065919f5b1c5 100644 --- a/vcl/backendtest/outputdevice/common.cxx +++ b/vcl/backendtest/outputdevice/common.cxx @@ -135,8 +135,8 @@ std::map<Color, int> collectColors(Bitmap& bitmap, const tools::Rectangle& recta { std::map<Color, int> colors; BitmapScopedWriteAccess pAccess(bitmap); - for( tools::Long y = rectangle.getY(); y < rectangle.GetHeight(); ++y) - for( tools::Long x = rectangle.getX(); x < rectangle.GetWidth(); ++x) + for (tools::Long y = rectangle.Top(); y < rectangle.Bottom(); ++y) + for (tools::Long x = rectangle.Left(); x < rectangle.Right(); ++x) ++colors[pAccess->GetPixel(y, x)]; // operator[] initializes to 0 (default ctor) if creating return colors; } diff --git a/vcl/backendtest/outputdevice/line.cxx b/vcl/backendtest/outputdevice/line.cxx index ad5995124a71..be9deadf9c33 100644 --- a/vcl/backendtest/outputdevice/line.cxx +++ b/vcl/backendtest/outputdevice/line.cxx @@ -126,12 +126,11 @@ Bitmap OutputDeviceTestLine::setupDashedLine() std::vector<double> stroke({ 2.0, 1.0 }); mpVirtualDevice->DrawPolyLineDirect( basegfx::B2DHomMatrix(), basegfx::B2DPolygon{ - basegfx::B2DPoint(rectangle.getX(), rectangle.getY()), - basegfx::B2DPoint(rectangle.getX(), rectangle.getY() + rectangle.getHeight()), - basegfx::B2DPoint(rectangle.getX() + rectangle.getWidth(), - rectangle.getY() + rectangle.getHeight()), - basegfx::B2DPoint(rectangle.getX() + rectangle.getWidth(), rectangle.getY()), - basegfx::B2DPoint(rectangle.getX(), rectangle.getY())}, + basegfx::B2DPoint(rectangle.Left(), rectangle.Top()), + basegfx::B2DPoint(rectangle.Left(), rectangle.Bottom()), + basegfx::B2DPoint(rectangle.Right(), rectangle.Bottom()), + basegfx::B2DPoint(rectangle.Right(), rectangle.Top()), + basegfx::B2DPoint(rectangle.Left(), rectangle.Top())}, 1, 0, &stroke, basegfx::B2DLineJoin::NONE ); return mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize()); |