summaryrefslogtreecommitdiffstats
path: root/src/sp-pattern.cpp
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2016-08-12 04:11:03 +0000
committerTed Gould <ted@gould.cx>2016-08-12 04:11:03 +0000
commitff848ebc9919d158c3ec3d7420e72b6aca99a3ea (patch)
tree030ab171865d0ed7f6bae3ef68315639cdb2622b /src/sp-pattern.cpp
parentMerging 0.92.x branch (diff)
parentCloneTiler: Further C++ification (diff)
downloadinkscape-ff848ebc9919d158c3ec3d7420e72b6aca99a3ea.tar.gz
inkscape-ff848ebc9919d158c3ec3d7420e72b6aca99a3ea.zip
Merge trunk
(bzr r14950.1.20)
Diffstat (limited to 'src/sp-pattern.cpp')
-rw-r--r--src/sp-pattern.cpp36
1 files changed, 16 insertions, 20 deletions
diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp
index 55110f3c5..77fa9034d 100644
--- a/src/sp-pattern.cpp
+++ b/src/sp-pattern.cpp
@@ -13,14 +13,13 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
#include <cstring>
#include <string>
#include <glibmm.h>
#include <2geom/transforms.h>
-#include <sigc++/functors/mem_fun.h>
#include "svg/svg.h"
#include "display/cairo-utils.h"
@@ -30,10 +29,7 @@
#include "display/drawing-group.h"
#include "attributes.h"
#include "document-private.h"
-#include "uri.h"
-#include "style.h"
#include "sp-pattern.h"
-#include "xml/repr.h"
#include "sp-factory.h"
@@ -223,8 +219,8 @@ void SPPattern::_getChildren(std::list<SPObject *> &l)
{
for (SPPattern *pat_i = this; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) {
if (pat_i->firstChild()) { // find the first one with children
- for (SPObject *child = pat_i->firstChild(); child; child = child->getNext()) {
- l.push_back(child);
+ for (auto& child: pat_i->children) {
+ l.push_back(&child);
}
break; // do not go further up the chain if children are found
}
@@ -319,8 +315,8 @@ guint SPPattern::_countHrefs(SPObject *o) const
i++;
}
- for (SPObject *child = o->firstChild(); child != NULL; child = child->next) {
- i += _countHrefs(child);
+ for (auto& child: o->children) {
+ i += _countHrefs(&child);
}
return i;
@@ -508,13 +504,13 @@ Geom::OptRect SPPattern::viewbox() const
bool SPPattern::_hasItemChildren() const
{
- bool hasChildren = false;
- for (SPObject const *child = firstChild(); child && !hasChildren; child = child->getNext()) {
- if (SP_IS_ITEM(child)) {
- hasChildren = true;
+ for (auto& child: children) {
+ if (SP_IS_ITEM(&child)) {
+ return true;
}
}
- return hasChildren;
+
+ return false;
}
bool SPPattern::isValid() const
@@ -558,12 +554,12 @@ cairo_pattern_t *SPPattern::pattern_new(cairo_t *base_ct, Geom::OptRect const &b
Inkscape::DrawingGroup *root = new Inkscape::DrawingGroup(drawing);
drawing.setRoot(root);
- for (SPObject *child = shown->firstChild(); child != NULL; child = child->getNext()) {
- if (SP_IS_ITEM(child)) {
+ for (auto& child: shown->children) {
+ if (SP_IS_ITEM(&child)) {
// for each item in pattern, show it on our drawing, add to the group,
// and connect to the release signal in case the item gets deleted
Inkscape::DrawingItem *cai;
- cai = SP_ITEM(child)->invoke_show(drawing, dkey, SP_ITEM_SHOW_DISPLAY);
+ cai = SP_ITEM(&child)->invoke_show(drawing, dkey, SP_ITEM_SHOW_DISPLAY);
root->appendChild(cai);
}
}
@@ -654,9 +650,9 @@ cairo_pattern_t *SPPattern::pattern_new(cairo_t *base_ct, Geom::OptRect const &b
// Render drawing to pattern_surface via drawing context, this calls root->render
// which is really DrawingItem->render().
drawing.render(dc, one_tile);
- for (SPObject *child = shown->firstChild(); child != NULL; child = child->getNext()) {
- if (SP_IS_ITEM(child)) {
- SP_ITEM(child)->invoke_hide(dkey);
+ for (auto& child: shown->children) {
+ if (SP_IS_ITEM(&child)) {
+ SP_ITEM(&child)->invoke_hide(dkey);
}
}