Bug 416126 - Mislabeled method: setRotation()
Summary: Mislabeled method: setRotation()
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Scripting (show other bugs)
Version: 4.2.8
Platform: Microsoft Windows Microsoft Windows
: NOR minor
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-11 18:01 UTC by Kapyia
Modified: 2020-01-28 09:50 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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