Bug 417992

Summary: Channels docker can have incorrect content that can be updated/corrected by various means
Product: [Applications] krita Reporter: Ahab Greybeard <ahab.greybeard>
Component: DockersAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: amy
Priority: NOR    
Version: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Debian stable   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Image file for convenient use and demonstration
After drawing green rectangle
After Undoing the drawing of the green rectangle

Description Ahab Greybeard 2020-02-21 13:08:57 UTC
Created attachment 126260 [details]
Image file for convenient use and demonstration

SUMMARY
This happens in 4.2.8 and the Feb 20th 4.3.0 git 2b45b5d appimages.
I've attached an example .kra file as a convenient demonstrator. This has a paint layer with blue, green and red painted lines that has been split to give alpha as a mask.

STEPS TO REPRODUCE
1. Note that with the example file initially opened, the channels display is correct and corresponds to the on-screen image.
2. Select the transparency mask and convert to a paint layer. This will be the top layer and is as expected, white lines on a black background.
3. Note that the channels display stays as it is instead of changing to represent the new appearance.
4. Note that the channels display can be 'updated/corrected' by changing the visibility of any of the layers or by clicking on the off-canvas workspace area or by painting on the canvas.
[A Close without saving and a repeat of steps 1 to 3 will be needed to note all of the above, obviously.]

5. Close without saving then re-Open then repeat steps 1,2,3.
6. Use the Move tool or the Transform tool to make a move or transform of the upper paint layer, finalised with a Return.
7. Note that the channels do not change and remain incorrect.
8. Note that the actions of step 4. will update/correct the channels

OBSERVED RESULT
See steps above

EXPECTED RESULT
The channels display should update when the transparency mask is first converted to a paint layer.

SOFTWARE/OS VERSIONS
Krita

 Version: 4.3.0-prealpha (git 2b45b5d)
 Languages: en_GB, en, en, en_GB, en
 Hidpi: true

Qt

  Version (compiled): 5.12.5
  Version (loaded): 5.12.5

OS Information

  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 4.19.0-6-amd64
  Pretty Productname: Debian GNU/Linux 10 (buster)
  Product Type: debian
  Product Version: 10

OpenGL Info
 
  Vendor:  "NVIDIA Corporation" 
  Renderer:  "GeForce GTX 750 Ti/PCIe/SSE2" 
  Version:  "4.6.0 NVIDIA 418.74" 
  Shading language:  "4.60 NVIDIA" 
  Requested format:  QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
  Current format:    QSurfaceFormat(version 4.6, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
     Version: 4.6
     Supports deprecated functions true 
     is OpenGL ES: false 

QPA OpenGL Detection Info 
  supportsDesktopGL: true 
  supportsOpenGLES: true 
  isQtPreferOpenGLES: false 

Hardware Information

  GPU Acceleration: auto
  Memory: 16039 Mb
  Number of Cores: 8
  Swap Location: /tmp

Current Settings

  Current Swap Location: /tmp
  Undo Enabled: 1
  Undo Stack Limit: 30
  Use OpenGL: 1
  Use OpenGL Texture Buffer: 1
  Use AMD Vectorization Workaround: 0
  Canvas State: OPENGL_SUCCESS
  Autosave Interval: 960
  Use Backup Files: 1
  Number of Backups Kept: 1
  Backup File Suffix: ~
  Backup Location: Same Folder as the File
  Use Win8 Pointer Input: 0
  Use RightMiddleTabletButton Workaround: 0
  Levels of Detail Enabled: 0
  Use Zip64: 0


Display Information
Number of screens: 2
	Screen: 0
		Name: DVI-D-1
		Depth: 24
		Scale: 1
		Resolution in pixels: 1280x1024
		Manufacturer: Dell Inc.
		Model: DELL 1704FPV-
		Refresh Rate: 60
	Screen: 1
		Name: DVI-D-0
		Depth: 24
		Scale: 1
		Resolution in pixels: 1280x1024
		Manufacturer: Dell Inc.
		Model: DELL 1704FPV-
		Refresh Rate: 60
Comment 1 amyspark 2020-02-21 14:12:14 UTC
Confirmed in my own build of master (75e30bed3b6a21789888f9b08669afc989dfd213).
Comment 2 amyspark 2020-02-21 16:50:11 UTC
Node changes like this one (convertNodeToPaintLayer) do not emit any signals at all, so nothing triggers KisImage's sigImageModified along the chain.
Comment 3 Ahab Greybeard 2020-02-21 17:39:14 UTC
Created attachment 126264 [details]
After drawing green rectangle

A further example of this:

The attached file Green-Rectangle-Drawn.png shows a similar failure to update the channels docker after drawing the green rectangle on the upper layer. This can be 'corrected' by toggling layers.

The attached file Green-Rectangle-Undone.png shows failure to update the channels docker after the green rectangle is removed by an Undo operation.

When the green rectangle is present and the channels are not correctly updated, repeated Move and Transform operations on the green rectangle do not update the channels docker.
Comment 4 Ahab Greybeard 2020-02-21 17:40:03 UTC
Created attachment 126265 [details]
After Undoing the drawing of the green rectangle
Comment 5 amyspark 2020-02-29 14:03:26 UTC
Git commit 340893a427ea79908df25605e9cda97d20007f37 by L. E. Segovia.
Committed on 29/02/2020 at 14:01.
Pushed by lsegovia into branch 'master'.

Set image as modified after a legacy action

This enables the Channel Docker to update itself when e.g. converting a
single lone transparency layer to a paint layer.

M  +8    -0    libs/image/kis_legacy_undo_adapter.cpp

https://invent.kde.org/kde/krita/commit/340893a427ea79908df25605e9cda97d20007f37
Comment 6 Dmitry Kazakov 2020-03-03 07:41:20 UTC
Git commit dbeea279f14dad6c9a647f978b8f74cba6c7a523 by Dmitry Kazakov, on behalf of L. E. Segovia.
Committed on 03/03/2020 at 07:40.
Pushed by dkazakov into branch 'krita/4.2'.

Set image as modified after a legacy action

This enables the Channel Docker to update itself when e.g. converting a
single lone transparency layer to a paint layer.

M  +8    -0    libs/image/kis_legacy_undo_adapter.cpp

https://invent.kde.org/kde/krita/commit/dbeea279f14dad6c9a647f978b8f74cba6c7a523