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

Boudewijn Rempt boud at valdyas.org
Thu Jul 24 15:21:09 UTC 2014


Git commit d2361a06831ca9daf19750c2fc85c4e2c84d1f63 by Boudewijn Rempt, on behalf of Dmitry Kazakov.
Committed on 02/07/2014 at 06:42.
Pushed by rempt into branch 'calligra/2.8'.

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/d2361a06831ca9daf19750c2fc85c4e2c84d1f63

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