Bug 423465

Summary: Wrong rendering when using "Destination Atop" blending mode
Product: [Applications] krita Reporter: Deif Lou <ginoba>
Component: GeneralAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: test image

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