summaryrefslogtreecommitdiffstats
path: root/src/sp-gradient.cpp
diff options
context:
space:
mode:
authorAdrian Boguszewski <adrbogus1@student.pg.gda.pl>2016-08-09 09:58:51 +0000
committerAdrian Boguszewski <adrbogus1@student.pg.gda.pl>2016-08-09 09:58:51 +0000
commite5143d65bb57d4ce623e6220585b099e6d2ee453 (patch)
tree4ff78f6fa8f0c1b740fd43b0ade2b91dbf9226d0 /src/sp-gradient.cpp
parentRemove deprecated Autotools and btool files. Please use CMake instead (diff)
parentMerged trunk (diff)
downloadinkscape-e5143d65bb57d4ce623e6220585b099e6d2ee453.tar.gz
inkscape-e5143d65bb57d4ce623e6220585b099e6d2ee453.zip
Merged gsoc work. Created better data structure for selections, replaced SPObject children list, improved spray tool, split tests to separate executables
(bzr r15047)
Diffstat (limited to 'src/sp-gradient.cpp')
-rw-r--r--src/sp-gradient.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp
index 49143bda4..f24e25ab1 100644
--- a/src/sp-gradient.cpp
+++ b/src/sp-gradient.cpp
@@ -269,8 +269,8 @@ void SPGradient::build(SPDocument *document, Inkscape::XML::Node *repr)
SPPaintServer::build(document, repr);
- for ( SPObject *ochild = this->firstChild() ; ochild ; ochild = ochild->getNext() ) {
- if (SP_IS_STOP(ochild)) {
+ for (auto& ochild: children) {
+ if (SP_IS_STOP(&ochild)) {
this->has_stops = TRUE;
break;
}
@@ -474,8 +474,8 @@ void SPGradient::remove_child(Inkscape::XML::Node *child)
SPPaintServer::remove_child(child);
this->has_stops = FALSE;
- for ( SPObject *ochild = this->firstChild() ; ochild ; ochild = ochild->getNext() ) {
- if (SP_IS_STOP(ochild)) {
+ for (auto& ochild: children) {
+ if (SP_IS_STOP(&ochild)) {
this->has_stops = TRUE;
break;
}
@@ -529,9 +529,9 @@ void SPGradient::modified(guint flags)
// FIXME: climb up the ladder of hrefs
GSList *l = NULL;
- for (SPObject *child = this->firstChild() ; child; child = child->getNext() ) {
- sp_object_ref(child);
- l = g_slist_prepend(l, child);
+ for (auto& child: children) {
+ sp_object_ref(&child);
+ l = g_slist_prepend(l, &child);
}
l = g_slist_reverse(l);
@@ -550,10 +550,11 @@ void SPGradient::modified(guint flags)
SPStop* SPGradient::getFirstStop()
{
- SPStop* first = 0;
- for (SPObject *ochild = firstChild(); ochild && !first; ochild = ochild->getNext()) {
- if (SP_IS_STOP(ochild)) {
- first = SP_STOP(ochild);
+ SPStop* first = nullptr;
+ for (auto& ochild: children) {
+ if (SP_IS_STOP(&ochild)) {
+ first = SP_STOP(&ochild);
+ break;
}
}
return first;
@@ -580,8 +581,8 @@ Inkscape::XML::Node *SPGradient::write(Inkscape::XML::Document *xml_doc, Inkscap
if (flags & SP_OBJECT_WRITE_BUILD) {
GSList *l = NULL;
- for (SPObject *child = this->firstChild(); child; child = child->getNext()) {
- Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags);
+ for (auto& child: children) {
+ Inkscape::XML::Node *crepr = child.updateRepr(xml_doc, NULL, flags);
if (crepr) {
l = g_slist_prepend(l, crepr);
@@ -908,8 +909,8 @@ bool SPGradient::invalidateArray()
void SPGradient::rebuildVector()
{
gint len = 0;
- for ( SPObject *child = firstChild() ; child ; child = child->getNext() ) {
- if (SP_IS_STOP(child)) {
+ for (auto& child: children) {
+ if (SP_IS_STOP(&child)) {
len ++;
}
}
@@ -930,9 +931,9 @@ void SPGradient::rebuildVector()
}
}
- for ( SPObject *child = firstChild(); child; child = child->getNext() ) {
- if (SP_IS_STOP(child)) {
- SPStop *stop = SP_STOP(child);
+ for (auto& child: children) {
+ if (SP_IS_STOP(&child)) {
+ SPStop *stop = SP_STOP(&child);
SPGradientStop gstop;
if (!vector.stops.empty()) {
@@ -1015,8 +1016,8 @@ void SPGradient::rebuildArray()
array.read( SP_MESH( this ) );
has_patches = false;
- for ( SPObject *ro = firstChild() ; ro ; ro = ro->getNext() ) {
- if (SP_IS_MESHROW(ro)) {
+ for (auto& ro: children) {
+ if (SP_IS_MESHROW(&ro)) {
has_patches = true;
// std::cout << " Has Patches" << std::endl;
break;