summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-01-09 15:53:22 +0300
committerXisco Fauli <xiscofauli@libreoffice.org>2022-01-11 09:58:32 +0100
commitb1e3f5d96b1093f42a4558a04ee607b2cde6f4bd (patch)
tree060292f89399bdae557a679a7e942cfa0858de71
parenttdf#146556 feature 'drag-mirror' is broken (diff)
downloadcore-b1e3f5d96b1093f42a4558a04ee607b2cde6f4bd.tar.gz
core-b1e3f5d96b1093f42a4558a04ee607b2cde6f4bd.zip
Slightly optimize code handling angles
Change-Id: I8bc10513f6cd704abc7a2bbb17d8d0d8d2628401 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128187 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit 1bdb4ddfc516d62f482f83fc6191e9585aa4786b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128230 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit 6273c0e0de093735396bf1b5a2151da943753eac) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128239
-rw-r--r--svx/source/svdraw/svdtrans.cxx14
1 files changed, 4 insertions, 10 deletions
diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx
index 39818941667d..0a00b9b44121 100644
--- a/svx/source/svdraw/svdtrans.cxx
+++ b/svx/source/svdraw/svdtrans.cxx
@@ -408,19 +408,13 @@ Degree100 NormAngle18000(Degree100 a)
Degree100 NormAngle36000(Degree100 a)
{
- while (a < 0_deg100) a += 36000_deg100;
- while (a >= 36000_deg100) a -= 36000_deg100;
+ a %= 36000_deg100;
+ if (a < 0_deg100)
+ a += 36000_deg100;
return a;
}
-sal_uInt16 GetAngleSector(Degree100 nAngle)
-{
- nAngle = NormAngle36000(nAngle);
- if (nAngle< 9000_deg100) return 0;
- if (nAngle<18000_deg100) return 1;
- if (nAngle<27000_deg100) return 2;
- return 3;
-}
+sal_uInt16 GetAngleSector(Degree100 nAngle) { return (NormAngle36000(nAngle) / 9000_deg100).get(); }
tools::Long GetLen(const Point& rPnt)
{