summaryrefslogtreecommitdiffstats
path: root/src/sp-filter.cpp
diff options
context:
space:
mode:
authorNiko Kiirala <niko@kiirala.com>2008-06-02 15:47:48 +0000
committerkiirala <kiirala@users.sourceforge.net>2008-06-02 15:47:48 +0000
commit1d5f41a11f9e31ff4efd285d5cac7a6788300e00 (patch)
tree668d9918814cc75b0586b1401b427bbd0364f0a2 /src/sp-filter.cpp
parentUpdated to reflect the recent file changes. (diff)
downloadinkscape-1d5f41a11f9e31ff4efd285d5cac7a6788300e00.tar.gz
inkscape-1d5f41a11f9e31ff4efd285d5cac7a6788300e00.zip
Fixed conflicting result image names inside filter effects (bug 196126)
(bzr r5787)
Diffstat (limited to 'src/sp-filter.cpp')
-rw-r--r--src/sp-filter.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp
index 150033895..e020f6814 100644
--- a/src/sp-filter.cpp
+++ b/src/sp-filter.cpp
@@ -22,6 +22,8 @@
using std::map;
using std::pair;
+#include <gtkmm.h>
+
#include "attributes.h"
#include "document.h"
#include "sp-filter.h"
@@ -114,6 +116,7 @@ sp_filter_init(SPFilter *filter)
filter->_image_name = new std::map<gchar *, int, ltstr>;
filter->_image_name->clear();
+ filter->_image_number_next = 0;
filter->filterRes = NumberOptNumber();
@@ -476,6 +479,28 @@ int sp_filter_set_image_name(SPFilter *filter, gchar const *name) {
return value;
}
+Glib::ustring sp_filter_get_new_result_name(SPFilter *filter) {
+ g_assert(filter != NULL);
+ int largest = 0;
+
+ SPObject *primitive_obj = filter->children;
+ while (primitive_obj) {
+ if (SP_IS_FILTER_PRIMITIVE(primitive_obj)) {
+ Inkscape::XML::Node *repr = SP_OBJECT_REPR(primitive_obj);
+ char const *result = repr->attribute("result");
+ int index;
+ if (result && sscanf(result, "result%d", &index) == 1) {
+ if (index > largest) {
+ largest = index;
+ }
+ }
+ }
+ primitive_obj = primitive_obj->next;
+ }
+
+ return "result" + Glib::Ascii::dtostr(largest + 1);
+}
+
bool ltstr::operator()(const char* s1, const char* s2) const
{
return strcmp(s1, s2) < 0;