diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2023-02-08 09:29:34 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-02-08 07:34:21 +0000 |
commit | dcc52933cac1bf08c3e487bd3a12fb035d96eac2 (patch) | |
tree | 174c1bed9be3a0aa528790c6abadf39564e47b75 | |
parent | d18096aeafa9ad5924f730cd39138fdf4f7d9609 (diff) |
Simplify a bit
Change-Id: I77482a2e1d382663ca31991130526feb7ce85504
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146647
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | svx/source/engine3d/scene3d.cxx | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index b5a1afb0f038..905f31fe6f08 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -522,24 +522,18 @@ void E3dScene::Notify(SfxBroadcaster &rBC, const SfxHint &rHint) void E3dScene::RotateScene (const Point& rRef, double sn, double cs) { - Point UpperLeft, LowerRight, Center, NewCenter; + Point NewCenter; auto const& rRectangle = getOutRectangle(); - UpperLeft = rRectangle.TopLeft(); - LowerRight = rRectangle.BottomRight(); - - tools::Long dxOutRectHalf = std::abs(UpperLeft.X() - LowerRight.X()); - dxOutRectHalf /= 2; - tools::Long dyOutRectHalf = std::abs(UpperLeft.Y() - LowerRight.Y()); - dyOutRectHalf /= 2; + Point Center = rRectangle.Center(); // Only the center is moved. The corners are moved by NbcMove. For the // rotation a cartesian coordinate system is used in which the pivot // point is the origin, and the y-axis increases upward, the X-axis to // the right. This must be especially noted for the Y-values. // (When considering a flat piece of paper the Y-axis pointing downwards - Center.setX( (UpperLeft.X() + dxOutRectHalf) - rRef.X() ); - Center.setY( -((UpperLeft.Y() + dyOutRectHalf) - rRef.Y()) ); + Center.setX(Center.X() - rRef.X()); + Center.setY(rRef.Y() - Center.Y()); // A few special cases has to be dealt with first (n * 90 degrees n integer) if (sn==1.0 && cs==0.0) { // 90deg NewCenter.setX( -Center.Y() ); |