Bug 404976 - Exporting as PNG with multiple Layers (One FX).
Summary: Exporting as PNG with multiple Layers (One FX).
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: File formats (show other bugs)
Version: 4.1.7
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords: regression, release_blocker
Depends on:
Blocks:
 
Reported: 2019-03-02 00:41 UTC by Dennis Fehr
Modified: 2019-04-22 19:42 UTC (History)
2 users (show)

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


Attachments
Test file for reproducing the problem (2.29 MB, application/zip)
2019-04-22 13:09 UTC, Dmitry Kazakov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Fehr 2019-03-02 00:41:21 UTC
SUMMARY
Doesn't save as a flattened image, or wait until it's rendered completely before making a thumbnail image / saving the flattened result.

STEPS TO REPRODUCE
1. Make a vector layer with stuff
2. Add FX on that layer
3. Maybe make another background fill layer
4. Export as PNG.

OBSERVED RESULT

I've noticed when exporting to PNG, and I have a vector layer with FX, it sometimes saves certain 'grid' blocks. It's as if it didn't wait for itself to finish completely render all grid blocks? The image shows as if it has some missing square puzzle pieces for example.

As a workaround, I have to flatten the image first then save. Which wastes a lot of time, because it's a complicated image and takes awhile to draw.. And I need to output 3 variants.

EXPECTED RESULT

A correctly "flattend" saved PNG file.

SOFTWARE/OS VERSIONS
Windows 10

ADDITIONAL INFORMATION

*IMPORTANT NOTE* It also doesn't save the thumbnail for the kra either.
Comment 1 Scott Petrovic 2019-03-31 14:40:03 UTC
This might be Windows specific bug. I am on Ubuntu and PNGs look ok with vector layers with FX (drop shadow).
Comment 2 Scott Petrovic 2019-04-05 14:29:19 UTC
I just tested this on a nightly build on Windows 10. PNGs seems to look ok to me with FX applied to vector layers. 

I am currently on a fresh nightly build. Could you test it out with one of these and see if it is still an issue?

https://binary-factory.kde.org/job/Krita_Nightly_Windows_Build/
Comment 3 Scott Petrovic 2019-04-05 15:03:58 UTC
changing to needs info
Comment 4 Dennis Fehr 2019-04-15 11:39:25 UTC
Hmm.. It may be that you need to add many layers, and many FX per layer.. Basically you want to make it so that it takes about 10 seconds to render or so. Add vector nodes, gradients, bevels, shadows, etc.

Try it like that.. Because it only seems to do it when it takes a long while to render.
Comment 5 Bug Janitor Service 2019-04-16 04:33:11 UTC
Thanks for your comment!

Automatically switching the status of this bug to REPORTED so that the KDE team
knows that the bug is ready to get confirmed.

In the future you may also do this yourself when providing needed information.
Comment 6 Halla Rempt 2019-04-16 09:37:21 UTC
Probably the same root cause as https://bugs.kde.org/show_bug.cgi?id=404742 -- but I'm not yet marking these as duplicates.
Comment 7 Dmitry Kazakov 2019-04-22 13:09:49 UTC
Created attachment 119554 [details]
Test file for reproducing the problem
Comment 8 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 404742

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