summaryrefslogtreecommitdiffstats
path: root/src/gradient-chemistry.cpp
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2017-11-03 00:10:02 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2017-11-03 00:10:02 +0000
commitd2df0412f728dd5bb54537dfdfe7c35b34d40e0e (patch)
treee2703384779e83312c456399999997fcc289c5cf /src/gradient-chemistry.cpp
parentMerge branch 'master' into powerpencil (diff)
parentchange assignment to equality (diff)
downloadinkscape-d2df0412f728dd5bb54537dfdfe7c35b34d40e0e.tar.gz
inkscape-d2df0412f728dd5bb54537dfdfe7c35b34d40e0e.zip
Merge branch 'master' into powerpencil
Diffstat (limited to 'src/gradient-chemistry.cpp')
-rw-r--r--src/gradient-chemistry.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp
index 05f594f86..cc676bffe 100644
--- a/src/gradient-chemistry.cpp
+++ b/src/gradient-chemistry.cpp
@@ -955,43 +955,36 @@ void sp_item_gradient_reverse_vector(SPItem *item, Inkscape::PaintTarget fill_or
sp_gradient_repr_set_link(gradient->getRepr(), vector);
}
- GSList *child_reprs = NULL;
- GSList *child_objects = NULL;
+ std::vector<SPObject *> child_objects;
+ std::vector<Inkscape::XML::Node *>child_reprs;
std::vector<double> offsets;
double offset;
for (auto& child: vector->children) {
- child_reprs = g_slist_prepend (child_reprs, child.getRepr());
- child_objects = g_slist_prepend (child_objects, &child);
+ child_reprs.push_back(child.getRepr());
+ child_objects.push_back(&child);
offset=0;
sp_repr_get_double(child.getRepr(), "offset", &offset);
offsets.push_back(offset);
}
- GSList *child_copies = NULL;
- for (GSList *i = child_reprs; i != NULL; i = i->next) {
- Inkscape::XML::Node *repr = (Inkscape::XML::Node *) i->data;
+ std::vector<Inkscape::XML::Node *> child_copies;
+ for (auto repr:child_reprs) {
Inkscape::XML::Document *xml_doc = vector->getRepr()->document();
- child_copies = g_slist_append (child_copies, repr->duplicate(xml_doc));
+ child_copies.push_back(repr->duplicate(xml_doc));
}
- for (GSList *i = child_objects; i != NULL; i = i->next) {
- SPObject *child = SP_OBJECT (i->data);
- child->deleteObject();
+ for (auto i:child_objects) {
+ i->deleteObject();
}
std::vector<double>::iterator iter = offsets.end() - 1;
- for (GSList *i = child_copies; i != NULL; i = i->next) {
- Inkscape::XML::Node *copy = (Inkscape::XML::Node *) i->data;
+ for (auto copy:child_copies) {
vector->appendChildRepr(copy);
sp_repr_set_svg_double (copy, "offset", 1 - *iter);
--iter;
Inkscape::GC::release(copy);
}
-
- g_slist_free (child_reprs);
- g_slist_free (child_copies);
- g_slist_free (child_objects);
}
void sp_item_gradient_invert_vector_color(SPItem *item, Inkscape::PaintTarget fill_or_stroke)