Bug 459162

Summary: Copy / paste + Transform selection leaves unwanted paint pixels at selection origin position.
Product: [Applications] krita Reporter: antoinerol0
Component: Tools/SelectionAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73, griffinvalley
Priority: NOR    
Version: 5.1.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description antoinerol0 2022-09-15 13:42:57 UTC
STEPS TO REPRODUCE
1. create a layer
2. paint a shape
3. select a part of this shape
4. copy selection
5. paste selection 
6. transform selection and move it to another area
7. apply transform
8. deselect selection
9. transform again (we can see that transform area is bigger and include a thin pixel line)
10. control + clic on the layer to see better the extra paint pixels

OBSERVED RESULT
Copy / paste + Transform selection leaves unwanted paint pixels at selection origin position  
Here is a video capture showing the issue:
https://www.dropbox.com/s/ii9udw2poqfet6e/KRITA_CopyPaste_Issue_09152022.mp4?dl=0

EXPECTED RESULT
No extra painted pixels left at selection origin position. 


SOFTWARE/OS VERSIONS
Krita

 Version: 5.1.0
 Installation type: installer / portable package
 Hidpi: true

Qt

  Version (compiled): 5.12.12
  Version (loaded): 5.12.12

OS Information

  Build ABI: x86_64-little_endian-llp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: winnt
  Kernel Version: 10.0.19044
  Pretty Productname: Windows 10 (10.0)
  Product Type: windows
  Product Version: 10
Comment 1 wolthera 2023-01-19 12:34:55 UTC
Hi, thank you for your report.

I can confirm with the Krita Version: 5.2.0-prealpha (git 5c98a72) Appimage with Qt 5.15.7

This is at it's core a usability problem with anti-aliasing: When copy-pasting, the select stays, so when transforming, the selection is now 'anti-aliased' on top of the 'anti-aliased' source, leading to some pixels being missed when transforming.

I guess we should check what other software does here, or if they get around the problem by just not allowing anti-aliased selections by default.
Comment 2 Dmitry Kazakov 2024-08-22 16:39:26 UTC
Remove triaged keyword from CONFIRMED bugs
Comment 3 Dmitry Kazakov 2024-09-16 15:53:02 UTC
Yeah, I don't know if we can do anything about it. The workaround for the problem is easy: just deactivate the selection after pasting and the transform tool will switch into a full-layer transform mode. Let's ask on KA about possible solutions.
Comment 4 Dmitry Kazakov 2024-09-17 11:57:21 UTC
Git commit f29f62b21633f3fce3c3af6762b123bba87b4798 by Dmitry Kazakov.
Committed on 17/09/2024 at 11:56.
Pushed by dkazakov into branch 'kazakov/deselect-on-paste'.

Deselect selection when pasting from the clipboard

Now, when the user pastes data from clipboard, any active selection
is automatically deselected.

For "Paste" and "Paste At" the deselection action is baked into
the actual later addition action. For "Paste Into" action, the
deselection is added as a separate step.

M  +25   -4    libs/ui/actions/KisPasteActionFactories.cpp
M  +35   -7    libs/ui/kis_mimedata.cpp
M  +3    -1    libs/ui/kis_mimedata.h
M  +3    -2    libs/ui/kis_node_manager.cpp
M  +2    -1    libs/ui/kis_node_manager.h

https://invent.kde.org/graphics/krita/-/commit/f29f62b21633f3fce3c3af6762b123bba87b4798
Comment 5 Dmitry Kazakov 2024-09-18 11:49:17 UTC
Git commit d33f52e4c840602e604080a3f4de4d915d23fae8 by Dmitry Kazakov.
Committed on 18/09/2024 at 11:49.
Pushed by dkazakov into branch 'master'.

Deselect selection when pasting from the clipboard

Now, when the user pastes data from clipboard, any active selection
is automatically deselected.

For "Paste" and "Paste At" the deselection action is baked into
the actual later addition action. For "Paste Into" action, the
deselection is added as a separate step.

M  +25   -4    libs/ui/actions/KisPasteActionFactories.cpp
M  +35   -7    libs/ui/kis_mimedata.cpp
M  +3    -1    libs/ui/kis_mimedata.h
M  +3    -2    libs/ui/kis_node_manager.cpp
M  +2    -1    libs/ui/kis_node_manager.h

https://invent.kde.org/graphics/krita/-/commit/d33f52e4c840602e604080a3f4de4d915d23fae8
Comment 6 Dmitry Kazakov 2024-09-18 11:50:01 UTC
Git commit d1ec8ad8edfebda2cfd0336b0896868246fb4b56 by Dmitry Kazakov.
Committed on 18/09/2024 at 11:49.
Pushed by dkazakov into branch 'krita/5.2'.

Deselect selection when pasting from the clipboard

Now, when the user pastes data from clipboard, any active selection
is automatically deselected.

For "Paste" and "Paste At" the deselection action is baked into
the actual later addition action. For "Paste Into" action, the
deselection is added as a separate step.

M  +25   -4    libs/ui/actions/KisPasteActionFactories.cpp
M  +35   -7    libs/ui/kis_mimedata.cpp
M  +3    -1    libs/ui/kis_mimedata.h
M  +3    -2    libs/ui/kis_node_manager.cpp
M  +2    -1    libs/ui/kis_node_manager.h

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