From 2a3581c9a5e6d18b3cd0ea2fe523063a116af8f8 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 2 May 2016 09:47:14 +0200 Subject: Working on clip erase basic work done but broken (bzr r14865.1.1) --- src/sp-lpe-item.cpp | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'src/sp-lpe-item.cpp') diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index fdc2949d5..5753e9307 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -349,10 +349,10 @@ sp_lpe_item_create_original_path_recursive(SPLPEItem *lpeitem) { sp_lpe_item_create_original_path_recursive(SP_LPE_ITEM(mask->firstChild())); } - SPClipPath * clipPath = lpeitem->clip_ref->getObject(); - if(clipPath) + SPClipPath * clip_path = lpeitem->clip_ref->getObject(); + if(clip_path) { - sp_lpe_item_create_original_path_recursive(SP_LPE_ITEM(clipPath->firstChild())); + sp_lpe_item_create_original_path_recursive(SP_LPE_ITEM(clip_path->firstChild())); } if (SP_IS_GROUP(lpeitem)) { std::vector item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); @@ -383,10 +383,10 @@ sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem) { sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(mask->firstChild())); } - SPClipPath * clipPath = lpeitem->clip_ref->getObject(); - if(clipPath) + SPClipPath * clip_path = lpeitem->clip_ref->getObject(); + if(clip_path) { - sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(clipPath->firstChild())); + sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(clip_path->firstChild())); } } std::vector item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); @@ -405,10 +405,10 @@ sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem) { sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(mask->firstChild())); } - SPClipPath * clipPath = lpeitem->clip_ref->getObject(); - if(clipPath) + SPClipPath * clip_path = lpeitem->clip_ref->getObject(); + if(clip_path) { - sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(clipPath->firstChild())); + sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(clip_path->firstChild())); } repr->setAttribute("d", repr->attribute("inkscape:original-d")); repr->setAttribute("inkscape:original-d", NULL); @@ -640,10 +640,13 @@ bool SPLPEItem::hasPathEffectRecursive() const void SPLPEItem::apply_to_clippath(SPItem *item) { - SPClipPath *clipPath = item->clip_ref->getObject(); - if(clipPath) { - SPObject * clip_data = clipPath->firstChild(); - apply_to_clip_or_mask(SP_ITEM(clip_data), item); + SPClipPath *clip_path = item->clip_ref->getObject(); + if(clip_path) { + std::vector clip_path_list = clip_path->childList(true); + for ( std::vector::const_iterator iter=clip_path_list.begin();iter!=clip_path_list.end();++iter) { + SPObject * clip_data = *iter; + apply_to_clip_or_mask(SP_ITEM(clip_data), item); + } } if(SP_IS_GROUP(item)){ std::vector item_list = sp_item_group_item_list(SP_GROUP(item)); @@ -659,8 +662,11 @@ SPLPEItem::apply_to_mask(SPItem *item) { SPMask *mask = item->mask_ref->getObject(); if(mask) { - SPObject *mask_data = mask->firstChild(); - apply_to_clip_or_mask(SP_ITEM(mask_data), item); + std::vector mask_list = mask->childList(true); + for ( std::vector::const_iterator iter=mask_list.begin();iter!=mask_list.end();++iter) { + SPObject * mask_data = *iter; + apply_to_clip_or_mask(SP_ITEM(mask_data), item); + } } if(SP_IS_GROUP(item)){ std::vector item_list = sp_item_group_item_list(SP_GROUP(item)); -- cgit v1.2.3 From 35830f456cadaecf8b8e3944e3031a1a93f6cb41 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 3 Aug 2016 15:29:38 +0200 Subject: Removed unused includes, decreased compilation time. Once again (bzr r15034) --- src/sp-lpe-item.cpp | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/sp-lpe-item.cpp') diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index fdc2949d5..d9e53fbc5 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -13,7 +13,6 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" #endif #include "ui/tool/multi-path-manipulator.h" @@ -27,11 +26,7 @@ #include "sp-path.h" #include "sp-item-group.h" -#include "streq.h" -#include "macros.h" #include "attributes.h" -#include "sp-lpe-item.h" -#include "xml/repr.h" #include "uri.h" #include "message-stack.h" #include "inkscape.h" @@ -40,14 +35,10 @@ #include "sp-ellipse.h" #include "display/curve.h" #include "svg/svg.h" -#include <2geom/pathvector.h> #include "sp-clippath.h" #include "sp-mask.h" #include "ui/tools-switch.h" #include "ui/tools/node-tool.h" -#include "ui/tools/tool-base.h" - -#include /* LPEItem base class */ static void sp_lpe_item_enable_path_effects(SPLPEItem *lpeitem, bool enable); -- cgit v1.2.3 From 7f779f28e67eac1653e0f7751bb3f224b67894c7 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 15 Aug 2016 22:55:21 +0200 Subject: Fix a bunch of errors as reported at http://www.viva64.com/en/b/0419/ (bzr r15059) --- src/sp-lpe-item.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/sp-lpe-item.cpp') diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index d9e53fbc5..44dc684c9 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -201,9 +201,6 @@ Inkscape::XML::Node* SPLPEItem::write(Inkscape::XML::Document *xml_doc, Inkscape * returns true when LPE was successful. */ bool SPLPEItem::performPathEffect(SPCurve *curve, bool is_clip_or_mask) { - if (!this) { - return false; - } if (!curve) { return false; -- cgit v1.2.3 From 65477c4c8456ceb7ee9d1e630421d4d5c79619dc Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 17 Aug 2016 09:37:48 +0200 Subject: Add std::nothrow so tests of memory allocation work as expected. Should eventually be replaced by smart pointers. (bzr r15062) --- src/sp-lpe-item.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sp-lpe-item.cpp') diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 44dc684c9..85df070b8 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -703,7 +703,7 @@ SPLPEItem::apply_to_clip_or_mask(SPItem *clip_mask, SPItem *item) // LPE was unsuccesfull. Read the old 'd'-attribute. if (gchar const * value = repr->attribute("d")) { Geom::PathVector pv = sp_svg_read_pathv(value); - SPCurve *oldcurve = new SPCurve(pv); + SPCurve *oldcurve = new (std::nothrow) SPCurve(pv); if (oldcurve) { SP_SHAPE(clip_mask)->setCurve(oldcurve, TRUE); oldcurve->unref(); -- cgit v1.2.3 From 16cf6039cb46b426eb6005ed8e9ae710fa0c9bed Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 4 Sep 2016 11:22:09 +0200 Subject: Fix some chrash when apply LPE: ej- sometimes Gear (bzr r15103) --- src/sp-lpe-item.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/sp-lpe-item.cpp') diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 85df070b8..4719f98d0 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -460,7 +460,7 @@ void SPLPEItem::addPathEffect(std::string value, bool reset) if (SP_ACTIVE_DESKTOP ) { Inkscape::UI::Tools::ToolBase *ec = SP_ACTIVE_DESKTOP->event_context; if (INK_IS_NODE_TOOL(ec)) { - tools_switch(SP_ACTIVE_DESKTOP, TOOLS_LPETOOL); //mhh + tools_switch(SP_ACTIVE_DESKTOP, TOOLS_SELECT); //mhh tools_switch(SP_ACTIVE_DESKTOP, TOOLS_NODES); } } -- cgit v1.2.3