Bug 452146 - A Copy of a transparency mask or a filter mask is incomplete.
Summary: A Copy of a transparency mask or a filter mask is incomplete.
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layer Stack (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks: 456450
  Show dependency treegraph
 
Reported: 2022-04-01 11:16 UTC by Ahab Greybeard
Modified: 2022-07-07 18:50 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Tranparency and Filter Mask Copy flaw testing (609.46 KB, application/x-krita)
2022-04-01 11:16 UTC, Ahab Greybeard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ahab Greybeard 2022-04-01 11:16:05 UTC
Created attachment 147876 [details]
Tranparency and Filter Mask Copy flaw testing

SUMMARY
This is present in versions 4.4.8 onwards and is reported here for the Mar 31 5.1.0-prealpha (git 625152f808) appimage on Debian 10.

A copy of a transparency mask or a filter mask only has correct content in a region that was painted on.

A test file, 'Test-Trans-Filter-Masks.kra', is attached for convenience of testing.

STEPS TO REPRODUCE
1. Open the attached testing file and observe the content of Paint-1.
2. Turn on the Trans-1 transparency mask and note the painted content of two short grey lines.
3. Duplicate Trans-1 then drag it onto Paint-2 and turn on Paint-2.
4. Delete the duplicate of Trans-1.
5. Copy Trans-1 then Paste it onto Paint-2 and observe the effect on Paint-2.
6. Save the file, Close the document, Open it
7. Delete that now working copy of Trans-1 and repeat step 5.
8. Convert the copy of Trans-1 (which is on Paint-2) to a Paint Layer then Convert the resulting Paint Layer to a Transparency mask on Paint-2.
9. Repeat the processes of Step 2 to Step 8 but with the Filter-1 mask instead of the Trans-1 mask.

OBSERVED RESULT
3. This works with no problems.
5. The Copy of Trans-1 is only correct within a rectangular area that corresponds to the bounding box of the painted content, and seems to be slightly larger that that.
It is transparent outside that area.
6. The Copy of Trans-1 has been 'fixed'.
8. The Converted paint layer is correct and the then Converted tranparency mask is hence correct.

9. For the Filter-1 mask, similar observations will be made except that for the Paint Layer conversion process, the filter information is lost (as expected) and has to be specified again.

These observations are also seen for animated transparency masks and animated filter masks and also when Copying and then Pasting into a different open document.

EXPECTED RESULT
The Copied mask should be the same as the original, in all locations.

SOFTWARE/OS VERSIONS
Krita

 Version: 5.1.0-prealpha (git 625152f)
 Languages: en_GB, en, en, en_GB, en
 Hidpi: false

Qt

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

OS Information

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

OpenGL Info
 
  Vendor:  "NVIDIA Corporation" 
  Renderer:  "GeForce GTX 750 Ti/PCIe/SSE2" 
  Version:  "4.6.0 NVIDIA 460.73.01" 
  Shading language:  "4.60 NVIDIA" 
  Requested format:  QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize -1, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::DefaultSwapBehavior, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile) 
  Current format:  QSurfaceFormat(version 4.6, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 0, stencilBufferSize 0, samples -1, swapBehavior QSurfaceFormat::DefaultSwapBehavior, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
     Version: 4.6
     Supports deprecated functions true 
     is OpenGL ES: false 
  supportsBufferMapping: true 
  supportsBufferInvalidation: true
Comment 1 Dmitry Kazakov 2022-04-01 12:13:04 UTC
It looks like either default pixel or default bounds is not properly copied
Comment 2 Dmitry Kazakov 2022-04-01 12:46:35 UTC
Git commit a005597297574d7a735f29726dd76dd8953617ee by Dmitry Kazakov.
Committed on 01/04/2022 at 12:46.
Pushed by dkazakov into branch 'master'.

Add a workaround for the mask copying bug

This is not a real fix for the bug, because the default bounds
are still not fully correctly initialized on copying. But at least
this fix is suitable for Krita 5.0.x branch.

M  +13   -1    libs/image/kis_mask.cc

https://invent.kde.org/graphics/krita/commit/a005597297574d7a735f29726dd76dd8953617ee
Comment 3 Dmitry Kazakov 2022-04-01 12:48:01 UTC
Git commit af4eaf6c8520f4bc4c52514f8b2ded64462f3402 by Dmitry Kazakov.
Committed on 01/04/2022 at 12:47.
Pushed by dkazakov into branch 'krita/5.0'.

Add a workaround for the mask copying bug

This is not a real fix for the bug, because the default bounds
are still not fully correctly initialized on copying. But at least
this fix is suitable for Krita 5.0.x branch.

M  +13   -1    libs/image/kis_mask.cc

https://invent.kde.org/graphics/krita/commit/af4eaf6c8520f4bc4c52514f8b2ded64462f3402
Comment 4 Dmitry Kazakov 2022-04-07 10:51:01 UTC
Git commit 8e2a29026406ca2e909834fbf89cde3d783e2d29 by Dmitry Kazakov.
Committed on 07/04/2022 at 10:50.
Pushed by dkazakov into branch 'master'.

Add a warning at the place of a previously assert in KisMask::setImage

M  +5    -6    libs/image/kis_mask.cc

https://invent.kde.org/graphics/krita/commit/8e2a29026406ca2e909834fbf89cde3d783e2d29
Comment 5 Dmitry Kazakov 2022-04-07 10:51:09 UTC
Git commit 81f9b1aac89d3b00e5f357dd235e6c37f002f5fb by Dmitry Kazakov.
Committed on 07/04/2022 at 10:50.
Pushed by dkazakov into branch 'master'.

Fix initialization of image link in the pasted nodes

I'm not sure this patch is safe enough for 5.0.x branch.

M  +15   -11   libs/image/kis_image.cc
M  +4    -1    libs/image/kis_node.cpp
M  +2    -1    libs/image/tests/KisKeyframeAnimationInterfaceSignalTest.cpp
M  +3    -4    libs/ui/kis_mimedata.cpp
M  +0    -1    plugins/impex/libkra/kis_kra_loader.cpp

https://invent.kde.org/graphics/krita/commit/81f9b1aac89d3b00e5f357dd235e6c37f002f5fb