svx/source/svdraw/svdtrans.cxx |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit d53def429f39486af22a3ac2a95c057ef9f308eb
Author:     Noel Grandin <[email protected]>
AuthorDate: Sat Jan 8 19:06:14 2022 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Mon Jan 10 17:59:07 2022 +0100

    tdf#146556 feature 'drag-mirror' is broken
    
    regression from
        commit 11e52fe2979b0947814a49b9c17ec373795cbf8e
        introduce Degree100 strong_int type
    
    where I tried to introduce a more efficient NormAngle36000
    calculation, but it produces the wrong answer.
    
    Change-Id: Iefeb0849984bc59d3ce9191eaf6f064beba94c59
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128143
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>
    (cherry picked from commit 4c4ce3dc2133199f0d804a686a1e0cd0c9124914)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128153
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx
index 6af3a49ea873..39818941667d 100644
--- a/svx/source/svdraw/svdtrans.cxx
+++ b/svx/source/svdraw/svdtrans.cxx
@@ -406,13 +406,11 @@ Degree100 NormAngle18000(Degree100 a)
     return a;
 }
 
-Degree100 NormAngle36000(Degree100 deg100)
+Degree100 NormAngle36000(Degree100 a)
 {
-    // do an add because we want -90 to end up as 270
-    int a = 36000 + deg100.get();
-    a %= 36000;
-    a = std::abs(a);
-    return Degree100(a);
+    while (a < 0_deg100) a += 36000_deg100;
+    while (a >= 36000_deg100) a -= 36000_deg100;
+    return a;
 }
 
 sal_uInt16 GetAngleSector(Degree100 nAngle)

Reply via email to