diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index 72f059bdcdbb314b4e90ec2e03e9f5e732bc5ba9..5868140a6d25b101fe677b514e1c2cd51b84da8b 100644 (file)
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
sp_selected_path_boolop(bool_op_diff, SP_VERB_SELECTION_DIFF, _("Difference"));
}
+void
+sp_selected_path_diff_skip_undo()
+{
+ sp_selected_path_boolop(bool_op_diff, SP_VERB_NONE, _("Difference"));
+}
+
void
sp_selected_path_symdiff()
{
@@ -453,8 +459,8 @@ sp_selected_path_boolop(bool_op bop, const unsigned int verb, const Glib::ustrin
// adjust style properties that depend on a possible transform in the source object in order
// to get a correct style attribute for the new path
SPItem* item_source = SP_ITEM(source);
- NR::Matrix i2root = sp_item_i2root_affine(item_source);
- sp_item_adjust_stroke(item_source, i2root.expansion());
+ NR::Matrix i2root = from_2geom(sp_item_i2root_affine(item_source));
+ sp_item_adjust_stroke(item_source, NR::expansion(i2root));
sp_item_adjust_pattern(item_source, i2root);
sp_item_adjust_gradient(item_source, i2root);
sp_item_adjust_livepatheffect(item_source, i2root);
@@ -485,7 +491,7 @@ sp_selected_path_boolop(bool_op bop, const unsigned int verb, const Glib::ustrin
// premultiply by the inverse of parent's repr
SPItem *parent_item = SP_ITEM(sp_desktop_document(desktop)->getObjectByRepr(parent));
- NR::Matrix local = sp_item_i2doc_affine(parent_item);
+ NR::Matrix local = from_2geom(sp_item_i2doc_affine(parent_item));
gchar *transform = sp_svg_transform_write(local.inverse());
// now that we have the result, add it on the canvas
gchar const *val = sp_repr_css_property(css, "stroke", NULL);
if (val == NULL || strcmp(val, "none") == 0) {
- sp_curve_unref(curve);
+ curve->unref();
continue;
}
}
}
NR::Matrix const transform(item->transform);
- float const scale = transform.expansion();
+ float const scale = NR::expansion(transform);
gchar *style = g_strdup(SP_OBJECT_REPR(item)->attribute("style"));
SPStyle *i_style = SP_OBJECT(item)->style;
gchar const *mask = SP_OBJECT_REPR(item)->attribute("mask");
Path *orig = Path_for_item(item, false);
if (orig == NULL) {
g_free(style);
- sp_curve_unref(curve);
+ curve->unref();
continue;
}
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)) {
Inkscape::GC::release(repr);
- sp_curve_unref(curve);
+ curve->unref();
selection->remove(item);
SP_OBJECT(item)->deleteObject(false);
if (orig == NULL)
{
g_free(style);
- sp_curve_unref(curve);
+ curve->unref();
return;
}
delete theRes;
}
- sp_curve_unref(curve);
+ curve->unref();
if (res->descr_cmd.size() <= 1)
{
Path *orig = Path_for_item(item, false);
if (orig == NULL) {
g_free(style);
- sp_curve_unref(curve);
+ curve->unref();
continue;
}
did = true;
- sp_curve_unref(curve);
+ curve->unref();
// remember the position of the item
gint pos = SP_OBJECT_REPR(item)->position();
// remember parent
Path *orig = Path_for_item(item, false);
if (orig == NULL) {
g_free(style);
- sp_curve_unref(curve);
+ curve->unref();
return false;
}
- sp_curve_unref(curve);
+ curve->unref();
// remember the position of the item
gint pos = SP_OBJECT_REPR(item)->position();
// remember parent
continue;
if (simplifyIndividualPaths) {
- NR::Maybe<NR::Rect> itemBbox = item->getBounds(sp_item_i2d_affine(item));
+ NR::Maybe<NR::Rect> itemBbox = item->getBounds(from_2geom(sp_item_i2d_affine(item)));
if (itemBbox) {
simplifySize = L2(itemBbox->dimensions());
} else {
Path *dest = bpath_to_Path(bpath);
- if (doTransformation) {
- g_free(bpath); // see comment in bpath_for_curve
- }
-
- sp_curve_unref(curve);
+ g_free(bpath);
+
+ curve->unref();
return dest;
}
+/*
+ * 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)
{
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));
+ new_bpath = nr_artpath_affine(bpath, from_2geom(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)