svx/source/svdraw/svdtrans.cxx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
New commits: commit b1e3f5d96b1093f42a4558a04ee607b2cde6f4bd Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sun Jan 9 15:53:22 2022 +0300 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Jan 11 09:58:32 2022 +0100 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.kagan...@collabora.com> (cherry picked from commit 1bdb4ddfc516d62f482f83fc6191e9585aa4786b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128230 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit 6273c0e0de093735396bf1b5a2151da943753eac) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128239 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) {