summaryrefslogtreecommitdiffstats
path: root/src/object/sp-use-reference.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2018-05-31 11:59:40 +0000
committerTavmjong Bah <tavmjong@free.fr>2018-05-31 11:59:40 +0000
commitad8c369ad3bbf157360ae4c0c479ca3cdb016cf5 (patch)
tree58c03547e6f2ea21e80b2b4c2310cab41a85ac2e /src/object/sp-use-reference.cpp
parentMore boilerplate for 'textPath' 'side' attribute. (diff)
downloadinkscape-ad8c369ad3bbf157360ae4c0c479ca3cdb016cf5.tar.gz
inkscape-ad8c369ad3bbf157360ae4c0c479ca3cdb016cf5.zip
Implement rendering for 'textPath' 'side' attribute. No GUI.
Diffstat (limited to 'src/object/sp-use-reference.cpp')
-rw-r--r--src/object/sp-use-reference.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/object/sp-use-reference.cpp b/src/object/sp-use-reference.cpp
index ea8bc5e86..d35bdf579 100644
--- a/src/object/sp-use-reference.cpp
+++ b/src/object/sp-use-reference.cpp
@@ -36,7 +36,7 @@ static void sp_usepath_source_modified(SPObject *iSource, guint flags, SPUsePath
SPUsePath::SPUsePath(SPObject* i_owner):SPUseReference(i_owner)
{
owner=i_owner;
- originalPath = NULL;
+ originalPath = nullptr;
sourceDirty=false;
sourceHref = NULL;
sourceRepr = NULL;
@@ -48,8 +48,9 @@ SPUsePath::SPUsePath(SPObject* i_owner):SPUseReference(i_owner)
SPUsePath::~SPUsePath(void)
{
- delete originalPath;
- originalPath = NULL;
+ if (originalPath != nullptr) {
+ originalPath->unref();
+ }
_changed_connection.disconnect(); // to do before unlinking
@@ -196,36 +197,28 @@ sp_usepath_source_modified(SPObject */*iSource*/, guint /*flags*/, SPUsePath *of
void SPUsePath::refresh_source()
{
sourceDirty = false;
- delete originalPath;
- originalPath = NULL;
- // le mauvais cas: pas d'attribut d => il faut verifier que c'est une SPShape puis prendre le contour
- // [tr: The bad case: no d attribute. Must check that it's a SPShape and then take the outline.]
+ if (originalPath != nullptr) {
+ originalPath->unref();
+ }
+
SPObject *refobj = sourceObject;
if ( refobj == NULL ) return;
SPItem *item = SP_ITEM(refobj);
- SPCurve *curve = NULL;
if (SP_IS_SHAPE(item))
{
- curve = SP_SHAPE(item)->getCurve();
+ originalPath = SP_SHAPE(item)->getCurve()->copy();
}
else if (SP_IS_TEXT(item))
{
- curve = SP_TEXT(item)->getNormalizedBpath();
+ originalPath = SP_TEXT(item)->getNormalizedBpath()->copy();
}
else
{
return;
}
-
- if (curve == NULL)
- return;
-
- originalPath = new Path;
- originalPath->LoadPathVector(curve->get_pathvector(), item->transform, true);
- curve->unref();
}