Bug 398528 - Transparent tiff file layer above fill layer makes it render black
Summary: Transparent tiff file layer above fill layer makes it render black
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Layer Stack (other bugs)
Version First Reported In: 4.1.1
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-12 06:20 UTC by tkp
Modified: 2018-09-26 14:24 UTC (History)
3 users (show)

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


Attachments
Simple example tiff file layer makes fill layer render black (473.76 KB, application/zip)
2018-09-12 06:20 UTC, tkp
Details
screenshot that does not show the problem (614.79 KB, image/png)
2018-09-12 10:52 UTC, Halla Rempt
Details
4.2.0-pre-alpha-41c6768-x86_64 capture displaying the issue (366.40 KB, image/png)
2018-09-12 15:19 UTC, tkp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tkp 2018-09-12 06:20:39 UTC
Created attachment 114911 [details]
Simple example tiff file layer makes fill layer render black

Hi !

while debugging a old 3.3 file which renders black, I came across a curious minimal example.

Fill layers seem to render as black if there is a transparent tiff loaded as file layer above it.

Can anyone reproduce with attached file ?

- open the file, it renders a violet fill above the transparent tiff
- move "File layer TIFF" above "Fill layer"
- save, close and reload file
- the violet fill is now rendered black

- move "File layer TIFF" under "Fill layer"
- save, close and reload file
- the violet fill is violet again

With the png file-layer, the behaviour does not seem to appear.

Thanks for this great software !
Comment 1 Halla Rempt 2018-09-12 06:31:08 UTC
Hi,

I can reproduce this with 4.1.1, however with a build from the krita/4.1 and master branches, I cannot reproduce the issue anymore, so it has been fixed since the last release. 

But weirdly enough, the 4.1-based nightly build still shows the issue, while the master-based nightly build doesn't show the issue anymore.
Comment 2 tkp 2018-09-12 07:24:47 UTC
Thanks for the test and clues ! Is a build not showing the issue available somewhere or I should try to build from source ?

The issue is still visible in these nightly :

- https://binary-factory.kde.org/job/Krita_Stable_Appimage_Build/lastSuccessfulBuild/artifact/krita-4.1.1-cdd99ca-x86_64.appimage

- https://binary-factory.kde.org/job/Krita_Nightly_Appimage_Build/lastSuccessfulBuild/artifact/krita-4.2.0-pre-alpha-41c6768-x86_64.appimage
Comment 3 Halla Rempt 2018-09-12 10:52:23 UTC
Created attachment 114914 [details]
screenshot that does not show the problem

Actually, I do not see the issue in /krita-4.2.0-pre-alpha-41c6768-x86_64.appimage -- though I do see it in krita-4.1.1-cdd99ca-x86_64.appimage
Comment 4 mvowada 2018-09-12 14:02:42 UTC
(checked with Krita Appimage 4.2.0-pre-alpha (git 6e809bc) on Ubuntu 14.04 Unity)

Hello. It seems I can reproduce the issue reported:

    1. tiff file layer above a fill red colored layer
    2. save as kra
    3. close and reopen

Actual results: fill layer color changed to black
Expected: fill layer stays red
Comment 5 Halla Rempt 2018-09-12 14:13:02 UTC
That one is older than the appimage the original poster and I tested with, though.
Comment 6 tkp 2018-09-12 15:19:16 UTC
Created attachment 114916 [details]
4.2.0-pre-alpha-41c6768-x86_64 capture displaying the issue

Strange, the issue seem to still be visible in krita-4.2.0-pre-alpha-41c6768-x86_64.appimage on my side.

In my tests it is visible on all 4.x versions, not in 3.3.3.
The test file was created in 4.1.1.
Comment 7 tkp 2018-09-14 02:41:42 UTC
Correction : krita-4.0.4-x86_64.appimage doesn't display the issue on my side.
Comment 8 tkp 2018-09-26 07:41:20 UTC
Issue is still present for me using latest nightly (krita-4.2.0-pre-alpha-e94e365-x86_64.appimage).

I use the following script as a workaround to fix the layers after opening :

def resetFillLayers(parent):
  for node in parent.childNodes():
    if node.type() == "filllayer":
        node.setGenerator(node.generatorName(), node.filterConfig())
    resetFillLayers(node)

resetFillLayers(Krita.instance().activeDocument().rootNode())
Comment 9 Dmitry Kazakov 2018-09-26 13:40:03 UTC
I can confirm the bug in master. It appears quite randomly though.
Comment 10 Dmitry Kazakov 2018-09-26 14:24:23 UTC
Git commit 04a7adea3be2fc548fdaaa4550018fd24cd74aaa by Dmitry Kazakov.
Committed on 26/09/2018 at 14:24.
Pushed by dkazakov into branch 'master'.

Fix fill layers to be updated correctly while loading

Since recently, KisGeneratorLayer::udpate() has its own internal
cache of the projection. This cache should be reset before running
the update. That is why we should just set the filter once again.

M  +7    -2    plugins/impex/libkra/kis_kra_load_visitor.cpp

https://commits.kde.org/krita/04a7adea3be2fc548fdaaa4550018fd24cd74aaa