[calligra] libs/pigment/compositeops: Fix Erase composite op to handle the selections properly

Dmitry Kazakov dimula73 at gmail.com
Thu Jul 3 07:52:43 UTC 2014


Git commit db5b27198e29370da8df4b8674cea8c107fa1396 by Dmitry Kazakov.
Committed on 02/07/2014 at 06:42.
Pushed by dkazakov into branch 'master'.

Fix Erase composite op to handle the selections properly

Using blend() for applying a mask is surely a bad idea. Don't know why it
was used, but it was dated to 2007. Thanks Timothee for pointing out this
bug.

<Animtim> dmitryK: hey yesterday I noticed a nasty bug, and just took time to understand what trigger it : if I have a "transparent" selection, and try to paint in erase mode inside, it makes bad tip tiles artifacts
<Animtim> (to reproduce: create paint something at low opacity, do select opaque, and try to erase..)
<Animtim> erasing with any kind of brush engine makes the bug

CCMAIL:kimageshop at kde.org

M  +2    -3    libs/pigment/compositeops/KoCompositeOpErase.h

http://commits.kde.org/calligra/db5b27198e29370da8df4b8674cea8c107fa1396

diff --git a/libs/pigment/compositeops/KoCompositeOpErase.h b/libs/pigment/compositeops/KoCompositeOpErase.h
index 3391ebb..d6968c6 100644
--- a/libs/pigment/compositeops/KoCompositeOpErase.h
+++ b/libs/pigment/compositeops/KoCompositeOpErase.h
@@ -71,9 +71,8 @@ public:
                     quint8 U8_mask = *mask;
 
                     if (U8_mask != OPACITY_TRANSPARENT_U8) {
-                        srcAlpha = KoColorSpaceMaths< channels_type, channels_type >::blend(srcAlpha,
-                                   NATIVE_OPACITY_OPAQUE,
-                                   KoColorSpaceMaths<quint8, channels_type>::scaleToA(U8_mask));
+                        srcAlpha = KoColorSpaceMaths<channels_type>::
+                            multiply(srcAlpha, KoColorSpaceMaths<quint8, channels_type>::scaleToA(U8_mask));
                     } else {
                         srcAlpha = 0;
                     }



More information about the kimageshop mailing list