From: tgdwyer Date: Mon, 17 Jul 2006 05:35:08 +0000 (+0000) Subject: minor performance improvement X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fb5bcb25b81fe8e1f5903072c6005b3328c545a9;p=inkscape.git minor performance improvement --- diff --git a/src/libcola/connected_components.cpp b/src/libcola/connected_components.cpp index 7e72d46a7..0cf6ee45a 100644 --- a/src/libcola/connected_components.cpp +++ b/src/libcola/connected_components.cpp @@ -1,6 +1,7 @@ #include -#include "cola.h" +#include #include +#include "cola.h" using namespace std; namespace cola { @@ -34,15 +35,16 @@ namespace cola { unsigned id; bool visited; vector neighbours; + list::iterator listPos; Rectangle* r; }; // Depth first search traversal of graph to find connected component void dfs(Node* v, - set& remaining, + list& remaining, Component* component, map > &cmap) { v->visited=true; - remaining.erase(v); + remaining.erase(v->listPos); cmap[v->id]=make_pair(component,component->node_ids.size()); component->node_ids.push_back(v->id); component->rects.push_back(v->r); @@ -66,12 +68,12 @@ namespace cola { vector &components) { unsigned n=rs.size(); vector vs(n); - set remaining; + list remaining; for(unsigned i=0;i::const_iterator ei; SimpleConstraints::const_iterator ci; diff --git a/src/libvpsc/remove_rectangle_overlap.h b/src/libvpsc/remove_rectangle_overlap.h index 82f3ef494..baa15b594 100644 --- a/src/libvpsc/remove_rectangle_overlap.h +++ b/src/libvpsc/remove_rectangle_overlap.h @@ -12,8 +12,9 @@ * * Released under GNU LGPL. Read the file 'COPYING' for more information. */ - -class vpsc::Rectangle; +namespace vpsc { + class Rectangle; +} void removeRectangleOverlap(unsigned n, vpsc::Rectangle *rs[], double xBorder, double yBorder);