Bug 404742 - Mergedimage.png isn't rendered correctly in master.
Summary: Mergedimage.png isn't rendered correctly in master.
Status: RESOLVED WORKSFORME
Alias: None
Product: krita
Classification: Unclassified
Component: File formats (show other bugs)
Version: git master (please specify the git hash!)
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords: regression, release_blocker
Depends on:
Blocks:
 
Reported: 2019-02-23 15:09 UTC by wolthera
Modified: 2019-05-22 04:33 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wolthera 2019-02-23 15:09:59 UTC
SUMMARY
Mergedimage.png isn't rendered correctly, especially compared to the preview.png file. Thumbnails thus look fine, but file layer and other applications accessing the mergedimage.png do not.

STEPS TO REPRODUCE
1. Create a kra file with an image, a gradient for example.
2. Open the file with an unzipper
3. Look at mergedimage.png

OBSERVED RESULT
Mergedimage.png sometimes has missing blocks of pixels.

EXPECTED RESULT
Mergedimage.png looks like the merged image.

This does not always happen(the only file I had not seen it with was one with only a single vector layer), but it does happen with images of 652x899(each with a single vector layer and a raster layer), so it is not a size issue.

ADITIONAL
---------------------------------------------
Krita

  Version: 4.2.0-pre-alpha (git 0b5c34c)

Qt

  Version (compiled): 5.12.0
  Version (loaded): 5.12.0

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: KDE neon User Edition 5.15
  Product Type: neon
  Product Version: 18.04

OpenGL Info
 
  Vendor:  Intel Open Source Technology Center 
  Renderer:  "Mesa DRI Intel(R) UHD Graphics 620 (Kabylake GT2) " 
  Version:  "3.0 Mesa 18.2.2" 
  Shading language:  1.30 
  Requested format:  QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CompatibilityProfile) 
  Current format:    QSurfaceFormat(version 3.0, options QFlags<QSurfaceFormat::FormatOption>(DeprecatedFunctions), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 0, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 0, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile) 
     Version: 3.0
     Supports deprecated functions true 
     is OpenGL ES: false 

Hardware Information

  GPU Acceleration: auto
  Memory: 7725 Mb
  Number of Cores: 8
  Swap Location: /tmp
Comment 1 Halla Rempt 2019-04-16 09:36:54 UTC
Probably the same root cause as https://bugs.kde.org/show_bug.cgi?id=404976 -- instead of just copying the projection and not touching that when making the saving clone, the cloned image starts re-rendering itself. At least, that's what I suspect.
Comment 2 Dmitry Kazakov 2019-04-22 19:42:01 UTC
Git commit 741608695618b9a5e9d0d7f4790fa45bb27a979b by Dmitry Kazakov.
Committed on 22/04/2019 at 19:41.
Pushed by dkazakov into branch 'master'.

Add sanity check for the image being idle after cloning

M  +4    -0    libs/ui/KisDocument.cpp

https://invent.kde.org/kde/krita/commit/741608695618b9a5e9d0d7f4790fa45bb27a979b
Comment 3 Dmitry Kazakov 2019-04-22 19:42:01 UTC
Git commit f984eab0aa72495867b67c51a68531093d086729 by Dmitry Kazakov.
Committed on 22/04/2019 at 19:41.
Pushed by dkazakov into branch 'master'.

Fix artifacts when saving vector layers into PNG files

This patch has two parts:

1) KisShapeLayer should block the updates of the shape-canvas.
   When shapes are added to the layer, they initiate shape
   manager updates. That is not what we want, because all the
   rendered pixel data has already been copied in initShapeLayer()
   call.

2) Add a sanity check in KisDocument::initiateSavingInBackground().
   Theoretically, there should be no pending updates after cloning
   operation. But if they still appear somehow (which is a bug),
   just force them wait until they complete their execution.
Related: bug 404976

M  +7    -0    libs/image/KisDelayedUpdateNodeInterface.h
M  +11   -0    libs/image/kis_layer_utils.cpp
M  +1    -0    libs/image/kis_layer_utils.h
M  +6    -1    libs/image/kis_transform_mask.cpp
M  +1    -0    libs/image/kis_transform_mask.h
M  +17   -0    libs/ui/KisDocument.cpp
M  +5    -0    libs/ui/flake/KisReferenceImagesLayer.cpp
M  +9    -0    libs/ui/flake/kis_shape_layer.cc
M  +5    -0    libs/ui/flake/kis_shape_layer.h
M  +25   -3    libs/ui/flake/kis_shape_layer_canvas.cpp
M  +8    -0    libs/ui/flake/kis_shape_layer_canvas.h

https://invent.kde.org/kde/krita/commit/f984eab0aa72495867b67c51a68531093d086729
Comment 4 Dmitry Kazakov 2019-04-22 19:46:09 UTC
Hi, Wolthera!

Could you please check if the bug still appears in master? I have fixed the problems caused by vector layers trying to update themselves after cloning. But I cannot reproduce the steps you listed... and I cannot see how they can cause any problems.

I've also added a safe assert in the saving code. If the image is not idle during saving operation (e.g. it is updating something), it will show an assert.
Comment 5 Bug Janitor Service 2019-05-07 04:33:07 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 6 Bug Janitor Service 2019-05-22 04:33:08 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!