Bug 416126

Summary: Mislabeled method: setRotation()
Product: [Applications] krita Reporter: Kapyia <kapyia.art>
Component: ScriptingAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: halla
Priority: NOR    
Version: 4.2.8   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:

Description Kapyia 2020-01-11 18:01:24 UTC
The method 'setRotation' in libkis/Canvas.cpp is either mislabeled or incomplete. It rotates the canvas by the amount of the given angle instead of setting the canvas' rotation to that angle. This seems to be because 'setRotation' passes its unaltered argument on to a different method called 'rotateCanvas' without making adjustments.

The fix is to subtract the canvas' current rotation from the value of the argument before passing it on to 'rotateCanvas'. Or you could rename the function and adjust the documentation :P 

(I would submit a MR with a fix, but I don't have an environment set up to check if what I submit is valid C++ code)
Comment 1 Halla Rempt 2020-01-14 13:11:50 UTC
Thanks for the report. I've implemented and pushed your fix.
Comment 2 Halla Rempt 2020-01-14 13:11:58 UTC
Git commit 5631090c79833acdece0a7cc18712536b98eac13 by Boudewijn Rempt.
Committed on 14/01/2020 at 13:11.
Pushed by rempt into branch 'master'.

Fix the Canvas::setRotation method

M  +1    -1    libs/libkis/Canvas.cpp

https://invent.kde.org/kde/krita/commit/5631090c79833acdece0a7cc18712536b98eac13
Comment 3 Halla Rempt 2020-01-28 09:50:27 UTC
Git commit cdce9eb7a4f2bac227f00d8e26253b46cddc242a by Boudewijn Rempt.
Committed on 28/01/2020 at 09:09.
Pushed by rempt into branch 'krita/4.2'.

Fix the Canvas::setRotation method
(cherry picked from commit 5631090c79833acdece0a7cc18712536b98eac13)

M  +1    -1    libs/libkis/Canvas.cpp

https://invent.kde.org/kde/krita/commit/cdce9eb7a4f2bac227f00d8e26253b46cddc242a