summaryrefslogtreecommitdiffstats
path: root/src/splivarot.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-05-09 17:06:59 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-05-09 17:06:59 +0000
commitb5fbebdee9ad52de4b9b373998d91581b9fd9004 (patch)
tree31f6f2cdab11f3276ef6abad0775e8b6888e1d33 /src/splivarot.cpp
parentApply Sas' patch to improve import of SVG as in LP#227472 and the bugs mentio... (diff)
downloadinkscape-b5fbebdee9ad52de4b9b373998d91581b9fd9004.tar.gz
inkscape-b5fbebdee9ad52de4b9b373998d91581b9fd9004.zip
complete adding const to have only NArtBpath const * get_bpath() const; for accessing the protected member of SPCurve. Nowhere in Inkscape source is the path data changed of SPCurve, except within SPCurve's own methods ! So removed the non-const NArtBpath* get_bpath.
(bzr r5642)
Diffstat (limited to 'src/splivarot.cpp')
-rw-r--r--src/splivarot.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index aec2b8f6e..382f857cf 100644
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
@@ -826,7 +826,7 @@ sp_selected_path_outline()
SPShape *shape = SP_SHAPE(item);
- for (NArtBpath* bp = SP_CURVE_BPATH(shape->curve); bp->code != NR_END; bp++) {
+ for (NArtBpath const* bp = SP_CURVE_BPATH(shape->curve); bp->code != NR_END; bp++) {
for (int m = SP_MARKER_LOC_START; m < SP_MARKER_LOC_QTY; m++) {
if (sp_shape_marker_required (shape, m, bp)) {
@@ -1729,18 +1729,15 @@ Path_for_item(SPItem *item, bool doTransformation, bool transformFull)
Path *dest = bpath_to_Path(bpath);
- if (doTransformation) {
- g_free(bpath); // see comment in bpath_for_curve
- }
-
+ g_free(bpath);
+
curve->unref();
return dest;
}
/*
- * This function is buggy: it can either return a new NArtBpath, or an existing one.
- * It is therefore unclear whether the caller must g_free the path or not!
+ * This function always returns a new NArtBpath, the caller must g_free the returned path!
*/
NArtBpath *
bpath_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool transformFull)
@@ -1748,22 +1745,23 @@ bpath_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool transf
if (curve == NULL)
return NULL;
- NArtBpath *bpath = SP_CURVE_BPATH(curve);
+ NArtBpath const *bpath = SP_CURVE_BPATH(curve);
if (bpath == NULL) {
return NULL;
}
-
+
+ NArtBpath *new_bpath; // we will get a duplicate which has to be freed at some point!
if (doTransformation) {
- NArtBpath *new_bpath; // we will get a duplicate which has to be freed at some point!
if (transformFull) {
new_bpath = nr_artpath_affine(bpath, sp_item_i2doc_affine(item));
} else {
new_bpath = nr_artpath_affine(bpath, item->transform);
}
- bpath = new_bpath;
+ } else {
+ new_bpath = nr_artpath_affine(bpath, NR::identity());
}
- return bpath;
+ return new_bpath;
}
SPCurve* curve_for_item(SPItem *item)