summaryrefslogtreecommitdiffstats
path: root/src/ui/tools/spray-tool.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-10-29 01:37:02 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-10-29 01:37:02 +0000
commit6a0b7c70e7e07839551be32aba63ae4a6badee81 (patch)
treedee645da900a7738dc2905a0ff284a13c1ada6bf /src/ui/tools/spray-tool.cpp
parentFix a regression updating CSS data (diff)
downloadinkscape-6a0b7c70e7e07839551be32aba63ae4a6badee81.tar.gz
inkscape-6a0b7c70e7e07839551be32aba63ae4a6badee81.zip
Removed recursion from code because no speed improvements
Added swith to 100 on toogle no overlap button pointed by Mc. Fixed crash pointed by Mc selecting all+no overlap+click (bzr r14422.1.25)
Diffstat (limited to 'src/ui/tools/spray-tool.cpp')
-rw-r--r--src/ui/tools/spray-tool.cpp66
1 files changed, 5 insertions, 61 deletions
diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp
index f64e56a5b..29bfe1641 100644
--- a/src/ui/tools/spray-tool.cpp
+++ b/src/ui/tools/spray-tool.cpp
@@ -434,7 +434,7 @@ static bool fit_item(SPDesktop *desktop,
for (std::vector<SPItem*>::const_iterator j=items_selected.begin(); j!=items_selected.end(); j++) {
SPItem *item_selected = *j;
gchar const * spray_origin;
- if(!item->getAttribute("inkscape:spray-origin")){
+ if(!item_selected->getAttribute("inkscape:spray-origin")){
spray_origin = g_strdup_printf("#%s", item_selected->getId());
} else {
spray_origin = item_selected->getAttribute("inkscape:spray-origin");
@@ -518,8 +518,7 @@ static bool sp_spray_recursive(SPDesktop *desktop,
bool overlap,
bool picker,
bool visible,
- double offset,
- size_t &limit)
+ double offset)
{
bool did = false;
@@ -556,35 +555,7 @@ static bool sp_spray_recursive(SPDesktop *desktop,
SPCSSAttr *css = sp_repr_css_attr_new();
if(overlap || picker || visible){
if(!fit_item(desktop, item, a, move, center, angle, _scale, scale, picker, visible, overlap, offset, css)){
- limit += 1;
- //Limit recursion to 10 levels
- //Seems enough to chech if there is place to put new copie
- if(limit < 21){
- return sp_spray_recursive(desktop,
- selection,
- item,
- p,
- Geom::Point(),
- mode,
- radius,
- population,
- scale,
- scale_variation,
- false,
- mean,
- standard_deviation,
- ratio,
- tilt,
- rotation_variation,
- _distrib,
- overlap,
- picker,
- visible,
- offset,
- limit);
- } else {
- return false;
- }
+ return false;
}
}
SPItem *item_copied;
@@ -691,33 +662,7 @@ static bool sp_spray_recursive(SPDesktop *desktop,
SPCSSAttr *css = sp_repr_css_attr_new();
if(overlap || picker || visible){
if(!fit_item(desktop, item, a, move, center, angle, _scale, scale, picker, visible, overlap, offset, css)){
- limit += 1;
- if(limit < 21){
- return sp_spray_recursive(desktop,
- selection,
- item,
- p,
- Geom::Point(),
- mode,
- radius,
- population,
- scale,
- scale_variation,
- false,
- mean,
- standard_deviation,
- ratio,
- tilt,
- rotation_variation,
- _distrib,
- overlap,
- picker,
- visible,
- offset,
- limit);
- } else {
- return false;
- }
+ return false;
}
}
SPItem *item_copied;
@@ -794,8 +739,7 @@ static bool sp_spray_dilate(SprayTool *tc, Geom::Point /*event_p*/, Geom::Point
for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();i++){
SPItem *item = *i;
g_assert(item != NULL);
- size_t limit = 0;
- if (sp_spray_recursive(desktop, selection, item, p, vector, tc->mode, radius, population, tc->scale, tc->scale_variation, reverse, move_mean, move_standard_deviation, tc->ratio, tc->tilt, tc->rotation_variation, tc->distrib, tc->overlap, tc->picker, tc->visible, tc->offset, limit)) {
+ if (sp_spray_recursive(desktop, selection, item, p, vector, tc->mode, radius, population, tc->scale, tc->scale_variation, reverse, move_mean, move_standard_deviation, tc->ratio, tc->tilt, tc->rotation_variation, tc->distrib, tc->overlap, tc->picker, tc->visible, tc->offset)) {
did = true;
}
}