summaryrefslogtreecommitdiffstats
path: root/src/ui/tools/spray-tool.cpp
diff options
context:
space:
mode:
authorNicolas Dufour <nicoduf@yahoo.fr>2014-02-16 10:55:22 +0000
committerJazzyNico <nicoduf@yahoo.fr>2014-02-16 10:55:22 +0000
commitc984c2542484ace0c54bab9e353f0c29a45f6023 (patch)
tree8025f77978e28ef3c288d477c3345de2a1edf4be /src/ui/tools/spray-tool.cpp
parentExtensions. Scaling of stroke and some sizes into document units, Part 5 (Bug... (diff)
downloadinkscape-c984c2542484ace0c54bab9e353f0c29a45f6023.tar.gz
inkscape-c984c2542484ace0c54bab9e353f0c29a45f6023.zip
Fix console messages (see Bug #879058 - Spray Single Path Mode includes original object).
Fixed bugs: - https://launchpad.net/bugs/879058 (bzr r13031)
Diffstat (limited to 'src/ui/tools/spray-tool.cpp')
-rw-r--r--src/ui/tools/spray-tool.cpp24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/ui/tools/spray-tool.cpp b/src/ui/tools/spray-tool.cpp
index 4ea482461..14a3acd9a 100644
--- a/src/ui/tools/spray-tool.cpp
+++ b/src/ui/tools/spray-tool.cpp
@@ -430,7 +430,6 @@ static bool sp_spray_recursive(SPDesktop *desktop,
SPItem *parent_item = NULL; // Initial object
SPItem *item_copied = NULL; // Projected object
SPItem *unionResult = NULL; // Previous union
- SPItem *child_item = NULL; // Parent copy
int i=1;
for (GSList *items = g_slist_copy(const_cast<GSList *>(selection->itemList()));
@@ -453,21 +452,12 @@ static bool sp_spray_recursive(SPDesktop *desktop,
Geom::OptRect a = parent_item->documentVisualBounds();
if (a) {
- if (i == 1) {
- Inkscape::XML::Node *copy1 = old_repr->duplicate(xml_doc);
- parent->appendChild(copy1);
- SPObject *new_obj1 = doc->getObjectByRepr(copy1);
- child_item = SP_ITEM(new_obj1); // Conversion object->item
- unionResult = child_item;
- Inkscape::GC::release(copy1);
- }
-
if (_fid <= population) { // Rules the population of objects sprayed
// Duplicates the parent item
- Inkscape::XML::Node *copy2 = old_repr->duplicate(xml_doc);
- parent->appendChild(copy2);
- SPObject *new_obj2 = doc->getObjectByRepr(copy2);
- item_copied = SP_ITEM(new_obj2);
+ Inkscape::XML::Node *copy = old_repr->duplicate(xml_doc);
+ parent->appendChild(copy);
+ SPObject *new_obj = doc->getObjectByRepr(copy);
+ item_copied = SP_ITEM(new_obj);
// Move around the cursor
Geom::Point move = (Geom::Point(cos(tilt)*cos(dp)*dr/(1-ratio)+sin(tilt)*sin(dp)*dr/(1+ratio), -sin(tilt)*cos(dp)*dr/(1-ratio)+cos(tilt)*sin(dp)*dr/(1+ratio)))+(p-a->midpoint());
@@ -481,10 +471,12 @@ static bool sp_spray_recursive(SPDesktop *desktop,
// Union and duplication
selection->clear();
selection->add(item_copied);
- selection->add(unionResult);
+ if (unionResult) { // No need to add the very first item (initialized with NULL).
+ selection->add(unionResult);
+ }
sp_selected_path_union_skip_undo(selection, selection->desktop());
selection->add(parent_item);
- Inkscape::GC::release(copy2);
+ Inkscape::GC::release(copy);
did = true;
}
}