Bug 447255

Summary: Transform Mask make wrong calculation with perspective with a 90degree turn
Product: [Applications] krita Reporter: Alexey <o-din13>
Component: Tools/TransformAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: ahab.greybeard, dimula73
Priority: NOR    
Version: 5.0.0-beta2   
Target Milestone: ---   
Platform: Other   
OS: All   
Latest Commit: Version Fixed In:
Attachments: perspective with a 90degree turn
with fill layer
same t.mask on paint layer
Video: The control handle does not want to be moved

Description Alexey 2021-12-20 08:11:17 UTC
Created attachment 144704 [details]
perspective with a 90degree turn

Transform Mask make wrong calculation with perspective with a 90degree turn

STEPS TO REPRODUCE
1. Add Transform Mask
2. Get perspective transform
3. Rotate it by 90°
or open attachment ::)

OBSERVED RESULT
Glitched image with perspective transform

EXPECTED RESULT
Normal image with perspective transform

SOFTWARE/OS VERSIONS
Krita 4.4.7, ANGLE, OpenGL, Win7x62 sp1
Krita 5.0.0-beta5, OpenGL, Linux Mint 19.2
Comment 1 Alexey 2021-12-20 08:11:53 UTC
Created attachment 144705 [details]
with fill layer
Comment 2 Alexey 2021-12-20 08:14:10 UTC
Created attachment 144707 [details]
same t.mask on paint layer
Comment 3 Dmitry Kazakov 2021-12-20 08:18:47 UTC
Just a note, this bug is reproducible in Krita 4.4.7, so it is not a regression.
Comment 4 Ahab Greybeard 2021-12-20 14:27:23 UTC
Created attachment 144714 [details]
Video: The control handle does not want to be moved

Confirmed with the Dec 19 5.1.0-prealpha (git 5e7b12a) appimage on Debian 10.
The transform preview is good and the final image, after the transform is finalised, is good for a couple of seconds before the fine detail distortion appears.

While making the transform, there is some difficulty with moving the control handles in the final stages of the 90 degree rortaion. 
They snap back when you try to move them
A video example of this is attached.
Comment 5 Dmitry Kazakov 2021-12-20 16:32:08 UTC
Git commit 634b939438e3cd2f5e16d744ff043bf8fd7d9674 by Dmitry Kazakov.
Committed on 20/12/2021 at 16:28.
Pushed by dkazakov into branch 'master'.

Fix blurry results in 4-point Perspective Transform mode

It looks like if we try to apply the transform in two stages, the
intermediate image gets collapsed into a few-pixels-wide chunk and
therefore causing the final image to be extremely blurry.

M  +30   -29   plugins/tools/tool_transform2/kis_perspective_transform_strategy.cpp
M  +6    -0    plugins/tools/tool_transform2/kis_transform_utils.cpp

https://invent.kde.org/graphics/krita/commit/634b939438e3cd2f5e16d744ff043bf8fd7d9674
Comment 6 Dmitry Kazakov 2021-12-20 16:32:41 UTC
Git commit d2cd5b2024553863eb57273c17c087c3eb905bee by Dmitry Kazakov.
Committed on 20/12/2021 at 16:32.
Pushed by dkazakov into branch 'krita/5.0'.

Fix blurry results in 4-point Perspective Transform mode

It looks like if we try to apply the transform in two stages, the
intermediate image gets collapsed into a few-pixels-wide chunk and
therefore causing the final image to be extremely blurry.
(cherry picked from commit 634b939438e3cd2f5e16d744ff043bf8fd7d9674)

M  +30   -29   plugins/tools/tool_transform2/kis_perspective_transform_strategy.cpp
M  +6    -0    plugins/tools/tool_transform2/kis_transform_utils.cpp

https://invent.kde.org/graphics/krita/commit/d2cd5b2024553863eb57273c17c087c3eb905bee
Comment 7 Dmitry Kazakov 2021-12-20 16:34:12 UTC
Just a note: if you have an existing file with the 4-point perspective transform as a transform mask, please activate transform tool on it and move any handle a little bit. That will update a transform saved in the transform mask, so the blurry effect will go away.