summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7e60d67)
raw | patch | inline | side by side (parent: 7e60d67)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 12 Jul 2008 21:19:11 +0000 (21:19 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 12 Jul 2008 21:19:11 +0000 (21:19 +0000) |
src/nodepath.cpp | patch | blob | history |
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index 8bd7787e1f09a70ee749ef8cdd6de85f64069e87..56c38d7343ad939fbf573f59ce0ce9c7453c0903 100644 (file)
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
/* Creation from object */
-static NArtBpath const * subpath_from_bpath(Inkscape::NodePath::Path *np, NArtBpath const *b, gchar const *t);
-static gchar *parse_nodetypes(gchar const *types, gint length);
+static NArtBpath const * subpath_from_bpath(Inkscape::NodePath::Path *np, NArtBpath const *b, Inkscape::NodePath::NodeType const *t);
+static Inkscape::NodePath::NodeType * parse_nodetypes(gchar const *types, gint length);
/* Object updating */
if (curve == NULL)
return NULL;
- NArtBpath const *bpath = curve->get_bpath();
gint length = curve->get_length();
if (length == 0) {
curve->unref();
@@ -267,9 +266,10 @@ Inkscape::NodePath::Path *sp_nodepath_new(SPDesktop *desktop, SPObject *object,
}
gchar const *nodetypes = np->repr->attribute(np->repr_nodetypes_key);
- gchar *typestr = parse_nodetypes(nodetypes, length);
+ Inkscape::NodePath::NodeType *typestr = parse_nodetypes(nodetypes, length);
// create the subpath(s) from the bpath
+ NArtBpath const *bpath = curve->get_bpath();
NArtBpath const *b = bpath;
while (b->code != NR_END) {
b = subpath_from_bpath(np, b, typestr + (b - bpath));
// reverse the list, because sp_nodepath_subpath_new() used g_list_prepend instead of append (for speed)
np->subpaths = g_list_reverse(np->subpaths);
- g_free(typestr);
+ delete[] typestr;
curve->unref();
// create the livarot representation from the same item
/**
* Create new nodepath from b, make it subpath of np.
* \param t The node type.
- * \todo Fixme: t should be a proper type, rather than gchar
*/
-static NArtBpath const * subpath_from_bpath(Inkscape::NodePath::Path *np, NArtBpath const *b, gchar const *t)
+static NArtBpath const * subpath_from_bpath(Inkscape::NodePath::Path *np, NArtBpath const *b, Inkscape::NodePath::NodeType const *t)
{
NR::Point ppos, pos, npos;
@@ -470,7 +469,7 @@ static NArtBpath const * subpath_from_bpath(Inkscape::NodePath::Path *np, NArtBp
npos = pos;
}
Inkscape::NodePath::Node *n;
- n = sp_nodepath_node_new(sp, NULL, (Inkscape::NodePath::NodeType) *t, NR_MOVETO, &pos, &pos, &npos);
+ n = sp_nodepath_node_new(sp, NULL, *t, NR_MOVETO, &pos, &pos, &npos);
g_assert(sp->first == n);
g_assert(sp->last == n);
@@ -499,13 +498,14 @@ static NArtBpath const * subpath_from_bpath(Inkscape::NodePath::Path *np, NArtBp
}
/**
- * Convert from sodipodi:nodetypes to new style type string.
+ * Convert from sodipodi:nodetypes to new style type array.
*/
-static gchar *parse_nodetypes(gchar const *types, gint length)
+static
+Inkscape::NodePath::NodeType * parse_nodetypes(gchar const *types, gint length)
{
g_assert(length > 0);
- gchar *typestr = g_new(gchar, length + 1);
+ Inkscape::NodePath::NodeType *typestr = new Inkscape::NodePath::NodeType[length + 1];
gint pos = 0;