Bug 375585 - [mergedimage.png] Vectors layers are not correctly rendered anymore
Summary: [mergedimage.png] Vectors layers are not correctly rendered anymore
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: File formats (show other bugs)
Version: 3.1 Beta
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-26 14:00 UTC by David REVOY
Modified: 2017-03-17 13:05 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
[screenshot of the bug] (141.21 KB, image/jpeg)
2017-01-26 14:00 UTC, David REVOY
Details
[screenshot of the bug] (629.79 KB, image/jpeg)
2017-01-26 18:48 UTC, David REVOY
Details
Shows mergedimage.png and the krita rendered result side by side. (1.17 MB, image/png)
2017-01-27 15:50 UTC, wolthera
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David REVOY 2017-01-26 14:00:06 UTC
Created attachment 103653 [details]
[screenshot of the bug]

Hi,
This is a very new behavior on krita/3.1 branch for the *.png inside the *.kra archive files named 'mergedimage.png' : the vectors layers are not correctly rendered anymore.

To reproduce:
=============
- Download the page source to reproduce the bug here: https://share.kde.org/index.php/s/v7ZguRWnRHRHfMX
- Extract the *.zip file to get the *.kra file, open it with Krita ( krita3.1~git 2017-01-26 ). 
- Check the render on the canvas: the render is ok.
- Blink a random layer visibility ( this will trigger a fake modification to unlock possibility to save/overwrite the file ).
- Save modifications.


Result:
=======
Check the generated mergedimage.png inside the *.kra file with an archive editor. The rendering should be similar to screenshot in attachement to this bug-report: the panels in white around comic page are half missing, especially on bottom-right of the page. The vector layer 'Frame' on top of the layer stack wasn't correctly rendered.

Test I did:
===========
This bugs breaks my 'renderfarm' to render my webcomic pages, so it's jumping quickly on my eyes. Any older version of Krita (appimage) I have doesn't produce this behavior ( eg. krita 3.1.1 or 3.0.94 or 3.0.1 ). I can still workaround by opening files in a previous appimage and save/overwrite them this way. This bug is something new since I updated Krita yesterday (25 January 2017). The previous krita3.1~git build I had didn't produce this behaviour and probably was built a little week-ago.
Comment 1 wolthera 2017-01-26 16:31:33 UTC
So that between 19th and now then? There's not many changes to this type of code there, except for this: https://phabricator.kde.org/R37:bc167bc7a5fefdf08bb30b1571fdc356e4c5dcfe

But that should hardly touch vector code...
Comment 2 David REVOY 2017-01-26 18:48:38 UTC
Created attachment 103657 [details]
[screenshot of the bug]

Thank you for the hint @Wolthera. I tried to revert this commit and build again, but I still have the bug. (screenshot) I'll keep trying with previous version and keep an eye on it. It's possible to be specific to this file and I'll know more soon about it. 
This bug can be turned to 'wait for info'.
Comment 3 wolthera 2017-01-27 15:50:34 UTC
Created attachment 103670 [details]
Shows mergedimage.png and the krita rendered result side by side.

I can confirm on the 3.1.88 test appimage.
Comment 4 Halla Rempt 2017-01-28 08:44:28 UTC
Git commit da6a30f0e5257222ffd175de404ea3aa6f68ee69 by Boudewijn Rempt.
Committed on 28/01/2017 at 08:43.
Pushed by rempt into branch 'master'.

This takes more time, but should guarantee that all projections are correct.

M  +1    -1    libs/image/kis_image.h
M  +17   -18   libs/image/kis_paint_layer.cc
M  +1    -0    libs/ui/KisDocument.cpp

https://commits.kde.org/krita/da6a30f0e5257222ffd175de404ea3aa6f68ee69
Comment 5 Halla Rempt 2017-01-28 09:05:58 UTC
Git commit 3e009cff47dd842cb495b1804c0a3ff0753117f6 by Boudewijn Rempt.
Committed on 28/01/2017 at 09:05.
Pushed by rempt into branch 'krita/3.1'.

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

https://commits.kde.org/krita/3e009cff47dd842cb495b1804c0a3ff0753117f6
Comment 6 David REVOY 2017-02-01 07:12:20 UTC
Hey, I ran a big hour of new tests, and I have new informations changing everything!

New observations:
=================
The bug affect only vector-layers **with a layer-style on it**. On my example file, the layer-style was disabled (Fx icon on layer stack). So, this new information invalidate the time period information in my report. It can be old. I saw it only last evening. Even if the layer-style is disabled it's sufficient to trigger the bug (Fx icon is greyed, not removed). It's easy to reproduce with krita-3.1.2-x86_64.appimage but **also** krita-3.1.1-x86_64.appimage and krita-3.0.94-x86_64.appimage ... the bug is even more dramatic with krita-3.0.92-x86_64.appimage ( no tiles rendered at all in this situation ) *but* krita-3.0.1-Alpha-4c91a18-x86_64.appimage render everything correctly same for krita-3.0.1-x86_64.appimage , krita-3.0.1.1-x86_64.appimage , krita-3.0.91-x86_64.appimage ; so it means the bug born between 3.0.91 and 3.0.92! ( so between 2016-10-19 and ... 3.0.92 don't have tag in the code, but from blog-post 'Third Beta' it's on 2016-11-07 ).   Also, now I can reproduce the bug with any file, with this steps:

To reproduce bug from a new file:
=================================
1. open a new 512x512 px white document
2. create a vector layer on top
4. fill canvas with random vector circles, squares and lines
3. right-click on the vector-layer -> Layer-style
4. in Layer style dialog activate the check-box in front of Bevel and Emboss (and Enable Effects) and press OK.
5. Save the file as test.kra
6. On your file manager, open the *.kra file with an archive editor/extractor, and visualize the mergedimage.png

Result:
=======
mergedimage.png is empty: no tiles were fast enough to render.

Workaround: 
===========
- put all mis-rendered vector-layers inside group.
- remove the layer-styles.
Comment 7 David REVOY 2017-02-07 13:29:38 UTC
After more test, the mergedimage.png inside the *.kra has artifacts when this type of feature are involved in the *.kra project :
- filter-mask
- layer-styles. 
It doesn't matter if it's on vector or paint-layer. It's just the vector-layers make the bug more visible.
Comment 8 Halla Rempt 2017-03-14 08:49:39 UTC
Git commit 8fdf39f6957c3484c9751000ed3693901d7b309b by Boudewijn Rempt.
Committed on 14/03/2017 at 08:49.
Pushed by rempt into branch 'master'.

Disable copying the image before saving

The copy is incomplete, the copy doesn't copy the projection so
we need to re-render the image, which makes saving very slow, and
we're not saving in the background at this moment, so the copy
isn't useful.

Note: I have intentionally left the code intact, and added a warning.
Saving in the background is still todo.
Related: bug 374345

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

https://commits.kde.org/krita/8fdf39f6957c3484c9751000ed3693901d7b309b
Comment 9 Halla Rempt 2017-03-14 08:51:26 UTC
Git commit 50969d39d7e6712e8833a7e9db23a16c6c368f80 by Boudewijn Rempt.
Committed on 14/03/2017 at 08:51.
Pushed by rempt into branch 'krita/3.1'.

Disable copying the image before saving

The copy is incomplete, the copy doesn't copy the projection so
we need to re-render the image, which makes saving very slow, and
we're not saving in the background at this moment, so the copy
isn't useful.

Note: I have intentionally left the code intact, and added a warning.
Saving in the background is still todo.
Related: bug 374345

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

https://commits.kde.org/krita/50969d39d7e6712e8833a7e9db23a16c6c368f80