Bug 423465 - Wrong rendering when using "Destination Atop" blending mode
Summary: Wrong rendering when using "Destination Atop" blending mode
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: git master (please specify the git hash!)
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-24 23:57 UTC by Deif Lou
Modified: 2020-07-02 08:04 UTC (History)
0 users

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


Attachments
test image (571.14 KB, application/x-krita)
2020-06-24 23:57 UTC, Deif Lou
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Deif Lou 2020-06-24 23:57:12 UTC
Created attachment 129655 [details]
test image

The destination atop compositing op seems to mix the colors wrong with some artifacts in some cases.

Attached is a test image file.

STEPS TO REPRODUCE
1. Paint something in a transparent layer.
2. Paint something else a different color in another transparent layer on top of the previous, overlaping the two shapes.
3. Choose "Destination Atop" blending mode on the layer on top.

OBSERVED RESULT
Sample image: https://imgur.com/a/tcIngTC

EXPECTED RESULT
The artifacts shouldn't appear

SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux 
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.70.0
Qt Version: 5.15.0

ADDITIONAL INFORMATION
I looked at the code and think this could be fixed by modifying the file libs/pigment/compositeops/KoCompositeOpDestinationAtop.h
Changing lines 61 and 62:
channels_type srcMult= mul(src[channel], appliedAlpha);
dst[channel] = lerp(srcMult,dst[channel],dstAlpha);
by:
dst[channel] = lerp(src[channel],dst[channel],dstAlpha);
seems to solve the problem
Comment 1 Bug Janitor Service 2020-06-28 23:03:04 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/401
Comment 2 Dmitry Kazakov 2020-07-02 08:04:25 UTC
Git commit de9dc412bbc1b9cf83f973d1aa47ed01d105c5d4 by Dmitry Kazakov, on behalf of Deif Lou.
Committed on 02/07/2020 at 07:46.
Pushed by dkazakov into branch 'master'.

Fix destination atop rendering

M  +1    -3    libs/pigment/compositeops/KoCompositeOpDestinationAtop.h

https://invent.kde.org/graphics/krita/commit/de9dc412bbc1b9cf83f973d1aa47ed01d105c5d4
Comment 3 Dmitry Kazakov 2020-07-02 08:04:51 UTC
Git commit ffbfff5fc51a4da55458bbe1178d546f7912fb66 by Dmitry Kazakov, on behalf of Deif Lou.
Committed on 02/07/2020 at 08:04.
Pushed by dkazakov into branch 'krita/4.3'.

Fix destination atop rendering

M  +1    -3    libs/pigment/compositeops/KoCompositeOpDestinationAtop.h

https://invent.kde.org/graphics/krita/commit/ffbfff5fc51a4da55458bbe1178d546f7912fb66