Code

Default values for lots of filter attributes, see bug 372412.
authorjaspervdg <jaspervdg@users.sourceforge.net>
Thu, 7 May 2009 11:10:38 +0000 (11:10 +0000)
committerjaspervdg <jaspervdg@users.sourceforge.net>
Thu, 7 May 2009 11:10:38 +0000 (11:10 +0000)
src/filters/componenttransfer-funcnode.cpp
src/filters/composite.cpp
src/filters/displacementmap.cpp
src/filters/offset.cpp
src/filters/turbulence.cpp

index a83dda1bbcd85e44ad58a3f0d50da58469b3a9de..e66f85e70b8399b99d94637519fa90ca0e929297 100644 (file)
@@ -243,35 +243,35 @@ sp_fefuncnode_set(SPObject *object, unsigned int key, gchar const *value)
             }
             break;
         case SP_ATTR_SLOPE:
-            read_num = helperfns_read_number(value);
+            read_num = value ? helperfns_read_number(value) : 1;
             if (read_num != feFuncNode->slope) {
                 feFuncNode->slope = read_num;
                 object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
             }
             break;
         case SP_ATTR_INTERCEPT:
-            read_num = helperfns_read_number(value);
+            read_num = value ? helperfns_read_number(value) : 0;
             if (read_num != feFuncNode->intercept) {
                 feFuncNode->intercept = read_num;
                 object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
             }
             break;
         case SP_ATTR_AMPLITUDE:
-            read_num = helperfns_read_number(value);
+            read_num = value ? helperfns_read_number(value) : 1;
             if (read_num != feFuncNode->amplitude) {
                 feFuncNode->amplitude = read_num;
                 object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
             }
             break;
         case SP_ATTR_EXPONENT:
-            read_num = helperfns_read_number(value);
+            read_num = value ? helperfns_read_number(value) : 1;
             if (read_num != feFuncNode->exponent) {
                 feFuncNode->exponent = read_num;
                 object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
             }
             break;
         case SP_ATTR_OFFSET:
-            read_num = helperfns_read_number(value);
+            read_num = value ? helperfns_read_number(value) : 0;
             if (read_num != feFuncNode->offset) {
                 feFuncNode->offset = read_num;
                 object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
index 707c74854bf877a0a04b9fc7d727889ef72ad725..75ee0fd27301e0a752e49630e86d912827252e7a 100644 (file)
@@ -157,7 +157,7 @@ sp_feComposite_set(SPObject *object, unsigned int key, gchar const *value)
             break;
 
         case SP_ATTR_K1:
-            k_n = helperfns_read_number(value);
+            k_n = value ? helperfns_read_number(value) : 0;
             if (k_n != feComposite->k1) {
                 feComposite->k1 = k_n;
                 if (feComposite->composite_operator == COMPOSITE_ARITHMETIC)
@@ -166,7 +166,7 @@ sp_feComposite_set(SPObject *object, unsigned int key, gchar const *value)
             break;
 
         case SP_ATTR_K2:
-            k_n = helperfns_read_number(value);
+            k_n = value ? helperfns_read_number(value) : 0;
             if (k_n != feComposite->k2) {
                 feComposite->k2 = k_n;
                 if (feComposite->composite_operator == COMPOSITE_ARITHMETIC)
@@ -175,7 +175,7 @@ sp_feComposite_set(SPObject *object, unsigned int key, gchar const *value)
             break;
 
         case SP_ATTR_K3:
-            k_n = helperfns_read_number(value);
+            k_n = value ? helperfns_read_number(value) : 0;
             if (k_n != feComposite->k3) {
                 feComposite->k3 = k_n;
                 if (feComposite->composite_operator == COMPOSITE_ARITHMETIC)
@@ -184,7 +184,7 @@ sp_feComposite_set(SPObject *object, unsigned int key, gchar const *value)
             break;
 
         case SP_ATTR_K4:
-            k_n = helperfns_read_number(value);
+            k_n = value ? helperfns_read_number(value) : 0;
             if (k_n != feComposite->k4) {
                 feComposite->k4 = k_n;
                 if (feComposite->composite_operator == COMPOSITE_ARITHMETIC)
index 7d4100b0ebd7a32121c12a0b99dd991ee6fcbff8..047ee46368928641668e2f5c74516f5da2169644 100644 (file)
@@ -165,7 +165,7 @@ sp_feDisplacementMap_set(SPObject *object, unsigned int key, gchar const *value)
             }
             break;
         case SP_ATTR_SCALE:
-            read_num = helperfns_read_number(value);
+            read_num = value ? helperfns_read_number(value) : 0;
             if (read_num != feDisplacementMap->scale) {
                 feDisplacementMap->scale = read_num;
                 object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
index 2c01549d3aca287bf5a644c3df7ffb7ffdbfdb72..2bfeb4a1f69164c17dd834ed0ad3b791690a5c9e 100644 (file)
@@ -121,14 +121,14 @@ sp_feOffset_set(SPObject *object, unsigned int key, gchar const *value)
     double read_num;
     switch(key) {
         case SP_ATTR_DX:
-            read_num = helperfns_read_number(value);
+            read_num = value ? helperfns_read_number(value) : 0;
             if (read_num != feOffset->dx) {
                 feOffset->dx = read_num;
                 object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
             }
             break;
         case SP_ATTR_DY:
-            read_num = helperfns_read_number(value);
+            read_num = value ? helperfns_read_number(value) : 0;
             if (read_num != feOffset->dy) {
                 feOffset->dy = read_num;
                 object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
index 7c185f2af40b7603bdc7548ecc50d0dadf01a7e0..503f4488b01aec1a68e04b339b8989d51fa80a08 100644 (file)
@@ -169,7 +169,7 @@ sp_feTurbulence_set(SPObject *object, unsigned int key, gchar const *value)
             object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
             break;
         case SP_ATTR_NUMOCTAVES:
-            read_int = (int) helperfns_read_number(value);
+            read_int = value ? (int)floor(helperfns_read_number(value)) : 1;
             if (read_int != feTurbulence->numOctaves){
                 feTurbulence->numOctaves = read_int;
                 feTurbulence->updated = false;
@@ -177,7 +177,7 @@ sp_feTurbulence_set(SPObject *object, unsigned int key, gchar const *value)
             }
             break;
         case SP_ATTR_SEED:
-            read_num = helperfns_read_number(value);
+            read_num = value ? helperfns_read_number(value) : 0;
             if (read_num != feTurbulence->seed){
                 feTurbulence->seed = read_num;
                 feTurbulence->updated = false;