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

List:       kde-commits
Subject:    koffice/krita/plugins/paintops/libpaintop
From:       Bart Coppens <kde () bartcoppens ! be>
Date:       2008-12-31 1:03:37
Message-ID: 1230685417.254546.26770.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 903611 by coppens:

Somewhat more proper 'fix' for the bug referenced in r857756 (and revealed by the fix \
for bug 178599). The problem with that brush seems to have been  that it used a brush \
with brush selection modes for tiltx and tilty, which we do not implement/support \
yet. However, this brush had 0 subbrushes for  these tilt dimensions, and the \
previously used fallback mode for tiltx and so was 'Incremental', which does a modulo \
operation with the number of  subbrushes (in this case 0 -> division by 0).

CCBUG:178599



 M  +18 -2     kis_imagepipe_brush.cc  
 M  +1 -1      kis_imagepipe_brush.h  
 M  +1 -1      kis_imagepipe_brush_p.cpp  


--- trunk/koffice/krita/plugins/paintops/libpaintop/kis_imagepipe_brush.cc \
#903610:903611 @@ -159,6 +159,9 @@
     }
 
     m_d->data.resize(0);
+
+    sanitize();
+
     return true;
 }
 
@@ -311,8 +314,8 @@
             break;
         default:
             warnImage << "This parasite KisParasite::SelectionMode has not been \
                implemented. Reselecting"
-            << " to Incremental";
-            m_d->parasite.selection[i] = KisParasite::Incremental;
+            << " to Constant";
+            m_d->parasite.selection[i] = KisParasite::Constant; // Not incremental, \
since that assumes rank > 0  index = 0;
         }
         m_d->parasite.index[i] = index;
@@ -348,5 +351,18 @@
     return QString(".gih");
 }
 
+void KisImagePipeBrush::sanitize() {
+    for (int i = 0; i < m_d->parasite.dim; i++) {
+        // In the 2 listed cases, we'd divide by 0!
+        if (   m_d->parasite.selection[i] == KisParasite::Incremental
+              || m_d->parasite.selection[i] == KisParasite::Angular) {
+            if (m_d->parasite.rank[i] == 0) {
+                warnImage << "Brush" << name() << " has a wrong rank for its \
selection mode!"; +                m_d->parasite.selection[i] = \
KisParasite::Constant; +             }
+        }
+    }
+}
+
 #include "kis_imagepipe_brush.moc"
 
--- trunk/koffice/krita/plugins/paintops/libpaintop/kis_imagepipe_brush.h \
#903610:903611 @@ -110,7 +110,7 @@
     bool init();
     void setParasiteString(const QString& parasite);
     void selectNextBrush(const KisPaintInformation& info) const;
-
+    void sanitize(); // Force some default values in case the ones read in don't \
make sense  private:
     class Private;
     Private * const m_d;
--- trunk/koffice/krita/plugins/paintops/libpaintop/kis_imagepipe_brush_p.cpp \
#903610:903611 @@ -60,7 +60,7 @@
                 warnImage << "Sel: wrong index: " << selIndex << "(dim = " << dim << \
")";  }
         } else if (index.startsWith("rank")) {
-            int rankIndex = qMax(1, index.mid(strlen("rank")).toInt());
+            int rankIndex = index.mid(strlen("rank")).toInt();
             if (rankIndex < 0 || rankIndex > dim) {
                 warnImage << "Rankindex out of range: " << rankIndex;
                 continue;


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

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