Bug 411802

Summary: Local selection outline is rendered wrong in some cases
Product: [Applications] krita Reporter: Tiar <tamtamy.tymona>
Component: Tools/SelectionAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73, ghevan, jamesnoeckel, tysontanx
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Test .kra file

Description Tiar 2019-09-10 18:53:32 UTC
Created attachment 122582 [details]
Test .kra file

SUMMARY
In the attached file, the rendering of the local selection is different from the actual selection (checked by painting on the canvas).


STEPS TO REPRODUCE
1. Open the attached file.
2. Paint in a new color on Layer Top.
3. Paint in a new color on Layer Bottom.

OBSERVED RESULT
On both layers, the selection looks the same, ants are displayed in the middle of the canvas.
Painting on Layer Top is only in the ants-selected area, but painting on Layer Bottom works only on the bottom of the canvas, as if the selection was in a different place.
When I select any of the local selections, the mask preview is correct.

EXPECTED RESULT
Selection outline/ants should show the selected area correctly, just like the mask preview does.


ADDITIONAL NOTES
* How did I make this image *
I used Move Tool on the Local Selection.


* Similar bugs *
I'm pretty sure I saw this bug earlier in a different situation somewhere. I don't know if it was a bug report though and I couldn't find it now. I've found an older bug report though: bug 411057

SOFTWARE/OS VERSIONS
I checked it on two of my branches with different kinds of changes (so I know those changes are irrelevant) and the newest master commit was: d293c0de8de8f9e3
It also happens in 4.2.6 appimage.

Krita

 Version: 4.3.0-prealpha (git 5686f41)
 Languages: en_US
 Hidpi: false

Qt

  Version (compiled): 5.12.2
  Version (loaded): 5.12.2

OS Information

  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 4.15.0-45-generic
  Pretty Productname: Linux Mint 19.1
  Product Type: linuxmint
  Product Version: 19.1


Hardware Information

  GPU Acceleration: none
  Memory: 7771 Mb
  Number of Cores: 4
  Swap Location: /tmp
Comment 1 vanyossi 2019-09-12 00:06:09 UTC
I checked the file attached and painting occurs inside the outlined selection.
O also selected the local selection layer and move it using the "move tool" and as expected it now only painted on the new location of the selection.

Is there anything special we need to do to trigger this? or maybe it was a glitch no longer reproductible :/

tested in: 4.2.6 and master(b46a3e6d)
Comment 2 Tiar 2019-09-12 00:56:09 UTC
Ok, I checked the saved file and... well, the outline looks the same as I remember it, but painting now works accordingly. Before saving, I was only able to paint on the bottom of the picture (see the blue brush strokes).

Conclusion: it isn't only a visual glitch; it saves wrong to the file, too.

Anyway, to reproduce the issue you need to:
1. Make a new layer.
2. Use a rectangle selection on it.
3. Right-click on the layer and select "Add local selection".
4. Go to that selection and use the move tool to move the selection completely out of the range of the selection that was there before.

OBSERVED RESULT:
Outline doesn't move. Painting occurs in a different place (in the 'new' location of the selection) than the outline suggests. Also after saving, the painting will be available only in the 'old' location of the selection.

EXPECTED RESULTS:
Painting and outline are consistent. Painting area is also the same after saving and opening the file again.
Comment 3 vanyossi 2019-09-14 01:34:34 UTC
Setting this as confirmed, tested in 4.2.6. Selection outlineis not moved to updated position. Once in this state, outline is locked and updates only after a new selection is made.

Local selection and outline move appears to be broken in general.

1. Make selection as local selection
2. Hover selection to make move seelction cursor appear
3. click and drag to move selection. 

Selection outline will not update but selecting local selection layer shows seletion did move after drag action.
Comment 4 Dmitry Kazakov 2020-06-02 14:54:11 UTC
I can still reproduce in master
Comment 5 Dmitry Kazakov 2020-06-02 15:38:27 UTC
Git commit aa0956e545290602a2d8c1cb200e626edef3bc50 by Dmitry Kazakov.
Committed on 02/06/2020 at 15:38.
Pushed by dkazakov into branch 'krita/4.3'.

Fix moving local selection mask created from global selection

The problem was caused but a code-duplication bug in KisShapeSelection,
which resulted in sigMoveShapes() not being connected anywhere.

M  +24   -19   libs/ui/flake/kis_shape_selection.cpp
M  +1    -1    libs/ui/flake/kis_shape_selection.h

https://invent.kde.org/graphics/krita/commit/aa0956e545290602a2d8c1cb200e626edef3bc50
Comment 6 Dmitry Kazakov 2020-06-02 15:38:55 UTC
Git commit 6bc908a39711d20560e314a2bd2a1e198bb14e39 by Dmitry Kazakov.
Committed on 02/06/2020 at 15:38.
Pushed by dkazakov into branch 'master'.

Fix moving local selection mask created from global selection

The problem was caused but a code-duplication bug in KisShapeSelection,
which resulted in sigMoveShapes() not being connected anywhere.

M  +24   -19   libs/ui/flake/kis_shape_selection.cpp
M  +1    -1    libs/ui/flake/kis_shape_selection.h

https://invent.kde.org/graphics/krita/commit/6bc908a39711d20560e314a2bd2a1e198bb14e39
Comment 7 Dmitry Kazakov 2020-06-03 12:06:08 UTC
*** Bug 422404 has been marked as a duplicate of this bug. ***
Comment 8 Dmitry Kazakov 2020-06-03 12:42:07 UTC
*** Bug 411875 has been marked as a duplicate of this bug. ***