Bug 467811 - Cut content from alpha inheriting layer pastes out of place
Summary: Cut content from alpha inheriting layer pastes out of place
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layer Stack (other bugs)
Version First Reported In: 5.1.5
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords: regression
: 464483 467861 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-03-26 14:00 UTC by BroskiBaboski
Modified: 2023-07-21 15:33 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description BroskiBaboski 2023-03-26 14:00:17 UTC
SUMMARY
***
Cutting (or copying) content from an alpha inheriting layer pastes it completely elsewhere
***


STEPS TO REPRODUCE
1. Have a folder and 2 layers inside
2. Have the above layer inherit alpha
3. Cut content from the alpha inheriting layer
4. Paste

OBSERVED RESULT
The pasted content on the new created layer spawns elsewhere, sometimes out of canvas

EXPECTED RESULT
Pasted content would spawn in the same location it was cut from

SOFTWARE/OS VERSIONS
Operating System: EndeavourOS 
KDE Plasma Version: 5.27.3
KDE Frameworks Version: 5.104.0
Qt Version: 5.15.8
Kernel Version: 6.2.8-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 16 × AMD Ryzen 7 3700X 8-Core Processor
Memory: 31,3 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 2070 SUPER/PCIe/SSE2

ADDITIONAL INFORMATION
refer to this thread for visual examples
https://krita-artists.org/t/cut-paste-suddenly-doesnt-paste-in-place/61079
where I questioned the issue, got confirmed it is a bug and was requested reporting it
Comment 1 Ahab Greybeard 2023-03-26 14:17:03 UTC
I can Confirm that this bug is present in the 5.1.5 appimage and the 25 March 5.2.0-prealpha (git 87759eb0fd) appimage.

It seems to have been introduced in version 5.1.2 because version 5.1.1 and previous versions do not have this bug.
Comment 2 Freya Lupen 2023-03-30 00:49:30 UTC
Seems to have been caused by commit e41db7b6, which checks whether a paste is within image boundaries. Apparently alpha-inheriting layers have an empty exactBounds(), so they are caught in the 
> (!clip->exactBounds().contains(image->bounds()) && !clip->exactBounds().intersects(image->bounds()))
check and get pasted at the center of the image. (libs/ui/actions/KisPasteActionFactories.cpp@234/235)
Comment 3 Freya Lupen 2023-03-30 00:50:27 UTC
*** Bug 467861 has been marked as a duplicate of this bug. ***
Comment 4 Freya Lupen 2023-06-20 20:09:26 UTC
*** Bug 464483 has been marked as a duplicate of this bug. ***
Comment 5 Dmitry Kazakov 2023-07-21 14:53:25 UTC
Okay, I can reproduce
Comment 6 Dmitry Kazakov 2023-07-21 15:33:09 UTC
Git commit caaa5bc5645fc547dfa2e457808c3ab94918d55e by Dmitry Kazakov.
Committed on 21/07/2023 at 15:32.
Pushed by dkazakov into branch 'master'.

Fix cut-pasting of an alpha-inheriting layer

M  +1    -1    libs/ui/actions/KisPasteActionFactories.cpp
M  +16   -10   libs/ui/kis_clipboard.cc

https://invent.kde.org/graphics/krita/-/commit/caaa5bc5645fc547dfa2e457808c3ab94918d55e