diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-03 13:04:24 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-11-03 12:50:06 +0100 |
commit | 7e23fec4b72a3512b898a84dd07fb89f6a6af25a (patch) | |
tree | 8342fd6ee91c7b0001ccadf6402bd353e9c2489e /chart2/source/controller/main/ChartWindow.cxx | |
parent | 9c6aa26092c509ec11be686451c77033e3474b33 (diff) |
Introduce 'scale' to Point/Size/Rectangle, to simplify anisotropic scaling
Change-Id: I12c25838e8eec8d05e43b593790847c626edde31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124638
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'chart2/source/controller/main/ChartWindow.cxx')
-rw-r--r-- | chart2/source/controller/main/ChartWindow.cxx | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx index 7c114d5fff72..9f1ff9342c98 100644 --- a/chart2/source/controller/main/ChartWindow.cxx +++ b/chart2/source/controller/main/ChartWindow.cxx @@ -315,15 +315,11 @@ void ChartWindow::LogicInvalidate(const tools::Rectangle* pRectangle) if (!IsMapModeEnabled()) { - aRectangle.SetLeft( o3tl::convert(aRectangle.Left(), scaleX.GetDenominator(), scaleX.GetNumerator()) ); - aRectangle.SetRight( o3tl::convert(aRectangle.Right(), scaleX.GetDenominator(), scaleX.GetNumerator()) ); - aRectangle.SetTop( o3tl::convert(aRectangle.Top(), scaleY.GetDenominator(), scaleY.GetNumerator()) ); - aRectangle.SetBottom( o3tl::convert(aRectangle.Bottom(), scaleY.GetDenominator(), scaleY.GetNumerator()) ); + aRectangle = aRectangle.scale(scaleX.GetDenominator(), scaleX.GetNumerator(), + scaleY.GetDenominator(), scaleY.GetNumerator()); } - Point aOffset = this->GetOffsetPixelFrom(*pEditWin); - aOffset.setX( o3tl::convert(aOffset.X(), nXNum, nXDen) ); - aOffset.setY( o3tl::convert(aOffset.Y(), nYNum, nYDen) ); + Point aOffset = this->GetOffsetPixelFrom(*pEditWin).scale(nXNum, nXDen, nYNum, nYDen); aRectangle = tools::Rectangle(aRectangle.TopLeft() + aOffset, aRectangle.GetSize()); } |