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

List:       kde-commits
Subject:    koffice/krita
From:       Cyrille Berger <cyb () lepi ! org>
Date:       2008-04-30 23:24:50
Message-ID: 1209597890.402559.20253.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 802879 by berger:

* test KisMaskGenerator
* move KisMaskGenerators unserialisation in KisMaskGenerator

 M  +1 -1      image/kis_adjustment_layer.cc  
 M  +15 -0     image/kis_mask_generator.cc  
 M  +4 -0      image/kis_mask_generator.h  
 M  +6 -0      image/tests/CMakeLists.txt  
 AM            image/tests/kis_mask_generator_test.cpp   [License: GPL (v2+)]
 AM            image/tests/kis_mask_generator_test.h   [License: GPL (v2+)]
 M  +0 -1      image/tests/kis_paint_information_test.cpp  
 M  +1 -11     ui/kis_recorded_paint_actions.cc  


--- trunk/koffice/krita/image/kis_adjustment_layer.cc #802878:802879
@@ -130,7 +130,7 @@
 
 KisFilterConfiguration * KisAdjustmentLayer::filter() const
 {
-    Q_ASSERT(m_d->filterConfig);
+//     Q_ASSERT(m_d->filterConfig);
     return m_d->filterConfig;
 }
 
--- trunk/koffice/krita/image/kis_mask_generator.cc #802878:802879
@@ -30,6 +30,21 @@
     e.setAttribute( "autobrush_vfade", m_h / 2.0 - m_fv );
 }
 
+KisMaskGenerator* KisMaskGenerator::fromXML( const QDomElement& elt)
+{
+    double width = elt.attribute("autobrush_width","1.0").toDouble();
+    double height = elt.attribute("autobrush_height","1.0").toDouble();
+    double hfade = elt.attribute("autobrush_hfade","1.0").toDouble();
+    double vfade = elt.attribute("autobrush_vfade","1.0").toDouble();
+    QString typeShape = elt.attribute("autobrush_type", "circle");
+    if(typeShape == "circle")
+    {
+        return new KisCircleMaskGenerator(width, height, hfade, vfade);
+    } else {
+        return new KisRectangleMaskGenerator(width, height, hfade, vfade);
+    }
+}
+
 quint8 KisMaskGenerator::interpolatedValueAt(double x, double y)
 {
     double x_i = floor(x);
--- trunk/koffice/krita/image/kis_mask_generator.h #802878:802879
@@ -45,6 +45,10 @@
         virtual quint8 valueAt(double x, double y) =0;
         quint8 interpolatedValueAt(double x, double y);
         virtual void toXML(QDomDocument& , QDomElement&) const;
+        /**
+         * Unserialise a \ref KisMaskGenerator
+         */
+        static KisMaskGenerator* fromXML( const QDomElement&);
         double width() const { return m_w; }
         double height() const { return m_h; }
     protected:
--- trunk/koffice/krita/image/tests/CMakeLists.txt #802878:802879
@@ -567,6 +567,12 @@
 
 ########### next target ###############
 
+set(kis_mask_generator_test_SRCS kis_mask_generator_test.cpp )
+kde4_add_unit_test(KisMaskGeneratorTest TESTNAME krita-image-KisMaskGeneratorTest \
${kis_mask_generator_test_SRCS}) +target_link_libraries(KisMaskGeneratorTest \
${KDE4_KDEUI_LIBS} komain kritaimage ${QT_QTTEST_LIBRARY}) +
+########### next target ###############
+
 #set(kis_paintop_preset_test_SRCS kis_paintop_preset_test.cpp )
 #kde4_add_unit_test(KisPaintopPresetTest TESTNAME krita-image-KisPaintopPresetTest \
${kis_paintop_preset_test_SRCS})  #target_link_libraries(KisPaintopPresetTest  \
                ${KDE4_KDEUI_LIBS} komain kritaimage ${QT_QTTEST_LIBRARY})
** trunk/koffice/krita/image/tests/kis_mask_generator_test.cpp #property \
svn:eol-style  + native
** trunk/koffice/krita/image/tests/kis_mask_generator_test.cpp #property svn:keywords
   + Id
** trunk/koffice/krita/image/tests/kis_mask_generator_test.h #property svn:eol-style
   + native
** trunk/koffice/krita/image/tests/kis_mask_generator_test.h #property svn:keywords
   + Id
--- trunk/koffice/krita/image/tests/kis_paint_information_test.cpp #802878:802879
@@ -46,7 +46,6 @@
     QVERIFY( test.angle() == testUnS.angle() );
     QVERIFY( test.rotation() == testUnS.rotation() );
     QVERIFY( test.tangentialPressure() == testUnS.tangentialPressure() );
-    
 }
 
 
--- trunk/koffice/krita/ui/kis_recorded_paint_actions.cc #802878:802879
@@ -224,17 +224,7 @@
     QString type = elt.attribute("type","");
     if( type == "autobrush")
     {
-        double width = elt.attribute("autobrush_width","1.0").toDouble();
-        double height = elt.attribute("autobrush_height","1.0").toDouble();
-        double hfade = elt.attribute("autobrush_hfade","1.0").toDouble();
-        double vfade = elt.attribute("autobrush_vfade","1.0").toDouble();
-        QString typeShape = elt.attribute("autobrush_type", "circle");
-        if(typeShape == "circle")
-        {
-            return new KisAutoBrush(new KisCircleMaskGenerator(width, height, hfade, \
                vfade) );
-        } else {
-            return new KisAutoBrush(new KisRectangleMaskGenerator(width, height, \
                hfade, vfade) );
-        }
+        return new KisAutoBrush(KisMaskGenerator::fromXML( elt ) );
     } else {
         dbgUI << "Looking for brush " << name;
         QList<KisBrush*> resources = \
KisResourceServerProvider::instance()->brushServer()->resources();


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

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