From 76750e3eb87017e5b9aefb0c0148a67bbb3d7232 Mon Sep 17 00:00:00 2001 From: jaspervdg Date: Thu, 7 May 2009 11:10:38 +0000 Subject: [PATCH] Default values for lots of filter attributes, see bug 372412. --- src/filters/componenttransfer-funcnode.cpp | 10 +++++----- src/filters/composite.cpp | 8 ++++---- src/filters/displacementmap.cpp | 2 +- src/filters/offset.cpp | 4 ++-- src/filters/turbulence.cpp | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/filters/componenttransfer-funcnode.cpp b/src/filters/componenttransfer-funcnode.cpp index a83dda1bb..e66f85e70 100644 --- a/src/filters/componenttransfer-funcnode.cpp +++ b/src/filters/componenttransfer-funcnode.cpp @@ -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); diff --git a/src/filters/composite.cpp b/src/filters/composite.cpp index 707c74854..75ee0fd27 100644 --- a/src/filters/composite.cpp +++ b/src/filters/composite.cpp @@ -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) diff --git a/src/filters/displacementmap.cpp b/src/filters/displacementmap.cpp index 7d4100b0e..047ee4636 100644 --- a/src/filters/displacementmap.cpp +++ b/src/filters/displacementmap.cpp @@ -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); diff --git a/src/filters/offset.cpp b/src/filters/offset.cpp index 2c01549d3..2bfeb4a1f 100644 --- a/src/filters/offset.cpp +++ b/src/filters/offset.cpp @@ -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); diff --git a/src/filters/turbulence.cpp b/src/filters/turbulence.cpp index 7c185f2af..503f4488b 100644 --- a/src/filters/turbulence.cpp +++ b/src/filters/turbulence.cpp @@ -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; -- 2.30.2