Bug 458471 - Locking/Unlocking layer generate an update of layer stack
Summary: Locking/Unlocking layer generate an update of layer stack
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layer Stack (show other bugs)
Version: 5.1.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-29 16:03 UTC by grum999
Modified: 2023-04-19 14:17 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description grum999 2022-08-29 16:03:37 UTC
SUMMARY
In synthesis, if filter mask/transform mask is attached to a layer, lock/unlock action on layer and/or mask will generate an update of layer.

A more detailed an readable summary is available on krita-artists (https://krita-artists.org/t/locking-unlocking-layer-does-it-need-to-recompute-everything/46462/8?u=grum999)
There's different case/combination where it's possible to reproduce the problem (really not easy to write/provide clear explanation without text formatting here :-) )

Also note on krita-artists topice, there's 2 problem (this one and another one related to performance: problem about performance will be reported in an another bug report)


STEPS TO REPRODUCE
Describe only the first case of 7 described on krita-artists
1.  Create a new document (a large one 7000x5000 help to see better the problem)
2.  Fill paint layer
3.  Add a transform mask and edit it ("mesh transform" help to see better the problem, but problem occurs with any transform mode)
4a. Lock/Unlock paint layer and/or transform mask
4b. Alphalock/Alphaunlock paint layer

OBSERVED RESULT
Layer is updated (flickering canvas + update progress bar in status bar)


EXPECTED RESULT
Lock/Unlock shouldn't have an impact on canvas refresh

SOFTWARE/OS VERSIONS
  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 4.19.0-21-amd64
  Pretty Productname: Debian GNU/Linux 10 (buster)
  Product Type: debian
  Product Version: 10
  Desktop: KDE

ADDITIONAL INFORMATION
From python scripting
```
from krita import *

d=Krita.instance().activeDocument()
n=d.activeNode()
n.setLocked(not n.locked() )
# n.setAlphaLocked(not n.alphaLocked() )
```
We can see that update is not triggered

Problem seems to be related to action made from user interface only:
- modify value from layer stack 
- from layer stack when access to layer properties [F3] and change property, problem occurs too

Tested on Krita 4.2.8, 4.2.9, 4.3.0, 4.4.8, 5.0.6, 5.1.0, 5.2.0a
-> problem start to occurs from Krita 4.3.0
Comment 1 Halla Rempt 2022-09-07 12:02:02 UTC
I can confirm the issue with the file from https://bugs.kde.org/show_bug.cgi?id=458475
Comment 2 Hologram 2022-09-22 18:14:29 UTC
I am also noticing this on Krita 5.1.1+ on Windows 10. 

SUMMARY
Large file layers with a transform mask associated show noticeable slowdown when locking and unlocking the layer. That is because the layers are recomputed despite there being no visual change. 

STEPS TO REPRODUCE
1. I made an A2 CAD export and imported this PDF @300 DPI as a file layer in Krita. It's an (4960 x 7016 px image) when loaded in.
2. Then I added a transform mask to move the PDF to the center of my document, which is A3 size, 300 DPI.
3. (optional) Added a colour overlay (so the white background is grey and easier on the eyes). 

OBSERVATION
Locking and unlocking prompts a loading bar to recompute the layer. The larger the file is on placement, the longer this computation takes. 

EXPECTED RESULT
Krita shouldn't recompute the layer, when I haven't made any visual changes to it. 

If you wonder why I made a larger export than the file I am drawing on, it's because I only need to manage one export that I can than rescale and move around at hearts content as opposed to multiple smaller files.
Comment 3 Dmitry Kazakov 2023-04-19 14:17:29 UTC
Git commit 70e96b4a8ddfdc62935c464a6c5622568254523a by Dmitry Kazakov.
Committed on 19/04/2023 at 14:17.
Pushed by dkazakov into branch 'master'.

Don't start image recalculation when layer-locked property is changed

M  +28   -5    libs/image/commands/kis_node_property_list_command.cpp
M  +1    -1    libs/image/commands/kis_node_property_list_command.h

https://invent.kde.org/graphics/krita/commit/70e96b4a8ddfdc62935c464a6c5622568254523a