summaryrefslogtreecommitdiffstats
path: root/src/sp-lpe-item.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2013-10-04 20:24:32 +0000
committerJohan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>2013-10-04 20:24:32 +0000
commiteedaac6439c0c4edb489643335fcfc003607bf08 (patch)
treeb4e7fd9d1051af877ef1f0c821fe4951b2fce554 /src/sp-lpe-item.cpp
parentDo not allow NULL _spcurve to be set in PathManipulator. (diff)
downloadinkscape-eedaac6439c0c4edb489643335fcfc003607bf08.tar.gz
inkscape-eedaac6439c0c4edb489643335fcfc003607bf08.zip
LPE: add some const correctness, remove unused function, and fix potential crash bug
(bzr r12656)
Diffstat (limited to 'src/sp-lpe-item.cpp')
-rw-r--r--src/sp-lpe-item.cpp42
1 files changed, 26 insertions, 16 deletions
diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp
index b3e6182a4..0517201f1 100644
--- a/src/sp-lpe-item.cpp
+++ b/src/sp-lpe-item.cpp
@@ -531,6 +531,26 @@ bool SPLPEItem::hasPathEffect() const
return true;
}
+bool SPLPEItem::hasPathEffectOfType(int const type) const
+{
+ if (path_effect_list->empty()) {
+ return false;
+ }
+
+ for (PathEffectList::const_iterator it = path_effect_list->begin(); it != path_effect_list->end(); ++it)
+ {
+ LivePathEffectObject const *lpeobj = (*it)->lpeobject;
+ if (lpeobj) {
+ Inkscape::LivePathEffect::Effect const* lpe = lpeobj->get_lpe();
+ if (lpe && (lpe->effectType() == type)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
bool SPLPEItem::hasPathEffectRecursive() const
{
if (parent && SP_IS_LPE_ITEM(parent)) {
@@ -546,27 +566,17 @@ SPLPEItem::getPathEffectOfType(int type)
{
std::list<Inkscape::LivePathEffect::LPEObjectReference *>::iterator i;
for (i = path_effect_list->begin(); i != path_effect_list->end(); ++i) {
- Inkscape::LivePathEffect::Effect* lpe = (*i)->lpeobject->get_lpe();
- if (lpe && (lpe->effectType() == type)) {
- return lpe;
+ LivePathEffectObject *lpeobj = (*i)->lpeobject;
+ if (lpeobj) {
+ Inkscape::LivePathEffect::Effect* lpe = lpeobj->get_lpe();
+ if (lpe && (lpe->effectType() == type)) {
+ return lpe;
+ }
}
}
return NULL;
}
-/* Return false if the item is not a path or already has a shape applied */
-bool sp_lpe_item_can_accept_freehand_shape(SPLPEItem *lpeitem)
-{
- if (!SP_IS_PATH(lpeitem))
- return false;
-
- if (lpeitem->getPathEffectOfType(Inkscape::LivePathEffect::FREEHAND_SHAPE)) {
- return false;
- }
-
- return true;
-}
-
void sp_lpe_item_edit_next_param_oncanvas(SPLPEItem *lpeitem, SPDesktop *dt)
{
Inkscape::LivePathEffect::LPEObjectReference *lperef = sp_lpe_item_get_current_lpereference(lpeitem);