[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/krita/image
From:       Dmitry Kazakov <dimula73 () gmail ! com>
Date:       2010-11-13 21:44:57
Message-ID: 20101113214457.14905AC89E () svn ! kde ! org
[Download RAW message or body]

SVN commit 1196674 by dkazakov:

Fixed KisPainter::setAlphaLocked() not to break setChannelFlags()



 M  +14 -13    kis_painter.cc  


--- trunk/koffice/krita/image/kis_painter.cc #1196673:1196674
@@ -105,7 +105,6 @@
     KisPaintDeviceSP            polygon;
     qint32                      maskImageWidth;
     qint32                      maskImageHeight;
-    bool                        alphaLocked;
 };
 
 KisPainter::KisPainter()
@@ -149,7 +148,6 @@
     d->fillPainter = 0;
     d->maskImageWidth = 255;
     d->maskImageHeight = 255;
-    d->alphaLocked = false;
 
     KConfigGroup cfg = KGlobal::config()->group("");
     d->useBoundingDirtyRect = cfg.readEntry("aggregate_dirty_regions", true);
@@ -2007,7 +2005,6 @@
 {
     Q_ASSERT(d->channelFlags.isEmpty() || (uint)d->channelFlags.size() == \
d->colorSpace->channelCount());  d->channelFlags = channelFlags;
-    setLockAlpha(d->alphaLocked);
 }
 
 QBitArray KisPainter::channelFlags()
@@ -2189,23 +2186,27 @@
 
 void KisPainter::setLockAlpha(bool protect)
 {
-    d->alphaLocked = protect;
     if (d->channelFlags.isEmpty()) {
-        d->channelFlags = d->colorSpace->channelFlags(true, !d->alphaLocked, true, \
true); +        d->channelFlags = d->colorSpace->channelFlags(true, true, true, \
true);  }
+
+    QBitArray switcher =
+        d->colorSpace->channelFlags(protect, !protect, protect, protect);
+
+    if(protect) {
+        d->channelFlags &= switcher;
+    }
     else {
+        d->channelFlags |= switcher;
+    }
+
         Q_ASSERT((uint)d->channelFlags.size() == d->colorSpace->channelCount());
-        QList<KoChannelInfo*> channels = d->colorSpace->channels();
-        foreach (KoChannelInfo* channel, channels) {
-            if (channel->channelType() == KoChannelInfo::ALPHA) {
-                d->channelFlags.setBit(channel->index(), !d->alphaLocked);
             }
-        }
-    }
-}
 
 bool KisPainter::alphaLocked() const
 {
-    return d->alphaLocked;
+    QBitArray switcher =
+        d->colorSpace->channelFlags(false, true, false, false);
+    return !(d->channelFlags & switcher).count(true);
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic