From 53933f5fea9d07d1ba6304b88439fba257ee8c34 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Wed, 2 Feb 2011 22:24:36 +0100 Subject: update to latest 2geom ! (bzr r10025) --- src/sp-shape.cpp | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'src/sp-shape.cpp') diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 35364692b..59105a1c7 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -307,7 +307,7 @@ void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags) * Reference for behaviour of zero-length segments: * http://www.w3.org/TR/SVG11/implnote.html#PathElementImplementationNotes */ -Geom::Matrix sp_shape_marker_get_transform(Geom::Curve const & c1, Geom::Curve const & c2) +Geom::Affine sp_shape_marker_get_transform(Geom::Curve const & c1, Geom::Curve const & c2) { Geom::Point p = c1.pointAt(1); Geom::Curve * c1_reverse = c1.reverse(); @@ -334,10 +334,10 @@ Geom::Matrix sp_shape_marker_get_transform(Geom::Curve const & c1, Geom::Curve c return Geom::Rotate(ret_angle) * Geom::Translate(p); } -Geom::Matrix sp_shape_marker_get_transform_at_start(Geom::Curve const & c) +Geom::Affine sp_shape_marker_get_transform_at_start(Geom::Curve const & c) { Geom::Point p = c.pointAt(0); - Geom::Matrix ret = Geom::Translate(p); + Geom::Affine ret = Geom::Translate(p); if ( !c.isDegenerate() ) { Geom::Point tang = c.unitTangentAt(0); @@ -351,10 +351,10 @@ Geom::Matrix sp_shape_marker_get_transform_at_start(Geom::Curve const & c) return ret; } -Geom::Matrix sp_shape_marker_get_transform_at_end(Geom::Curve const & c) +Geom::Affine sp_shape_marker_get_transform_at_end(Geom::Curve const & c) { Geom::Point p = c.pointAt(1); - Geom::Matrix ret = Geom::Translate(p); + Geom::Affine ret = Geom::Translate(p); if ( !c.isDegenerate() ) { Geom::Curve * c_reverse = c.reverse(); @@ -393,7 +393,7 @@ void SPShape::sp_shape_update_marker_view(SPShape *shape, NRArenaItem *ai) // START marker { - Geom::Matrix const m (sp_shape_marker_get_transform_at_start(pathv.begin()->front())); + Geom::Affine const m (sp_shape_marker_get_transform_at_start(pathv.begin()->front())); for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START if ( shape->marker[i] ) { sp_marker_show_instance ((SPMarker* ) shape->marker[i], ai, @@ -411,7 +411,7 @@ void SPShape::sp_shape_update_marker_view(SPShape *shape, NRArenaItem *ai) if ( path_it != pathv.begin() && ! ((path_it == (pathv.end()-1)) && (path_it->size_default() == 0)) ) // if this is the last path and it is a moveto-only, don't draw mid marker there { - Geom::Matrix const m (sp_shape_marker_get_transform_at_start(path_it->front())); + Geom::Affine const m (sp_shape_marker_get_transform_at_start(path_it->front())); for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID if ( shape->marker[i] ) { sp_marker_show_instance ((SPMarker* ) shape->marker[i], ai, @@ -431,7 +431,7 @@ void SPShape::sp_shape_update_marker_view(SPShape *shape, NRArenaItem *ai) * Loop to end_default (so including closing segment), because when a path is closed, * there should be a midpoint marker between last segment and closing straight line segment */ - Geom::Matrix const m (sp_shape_marker_get_transform(*curve_it1, *curve_it2)); + Geom::Affine const m (sp_shape_marker_get_transform(*curve_it1, *curve_it2)); for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID if (shape->marker[i]) { sp_marker_show_instance ((SPMarker* ) shape->marker[i], ai, @@ -448,7 +448,7 @@ void SPShape::sp_shape_update_marker_view(SPShape *shape, NRArenaItem *ai) // END position if ( path_it != (pathv.end()-1) && !path_it->empty()) { Geom::Curve const &lastcurve = path_it->back_default(); - Geom::Matrix const m = sp_shape_marker_get_transform_at_end(lastcurve); + Geom::Affine const m = sp_shape_marker_get_transform_at_end(lastcurve); for (int i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID if (shape->marker[i]) { sp_marker_show_instance ((SPMarker* ) shape->marker[i], ai, @@ -471,7 +471,7 @@ void SPShape::sp_shape_update_marker_view(SPShape *shape, NRArenaItem *ai) index--; } Geom::Curve const &lastcurve = path_last[index]; - Geom::Matrix const m = sp_shape_marker_get_transform_at_end(lastcurve); + Geom::Affine const m = sp_shape_marker_get_transform_at_end(lastcurve); for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END if (shape->marker[i]) { @@ -506,7 +506,7 @@ void SPShape::sp_shape_modified(SPObject *object, unsigned int flags) * Calculates the bounding box for item, storing it into bbox. * This also includes the bounding boxes of any markers included in the shape. */ -void SPShape::sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags) +void SPShape::sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const &transform, unsigned const flags) { SPShape const *shape = SP_SHAPE (item); if (shape->curve) { @@ -570,7 +570,7 @@ void SPShape::sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker)); if (marker_item) { - Geom::Matrix tr(sp_shape_marker_get_transform_at_start(pathv.begin()->front())); + Geom::Affine tr(sp_shape_marker_get_transform_at_start(pathv.begin()->front())); if (!marker->orient_auto) { Geom::Point transl = tr.translation(); tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); @@ -602,7 +602,7 @@ void SPShape::sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const if ( path_it != pathv.begin() && ! ((path_it == (pathv.end()-1)) && (path_it->size_default() == 0)) ) // if this is the last path and it is a moveto-only, there is no mid marker there { - Geom::Matrix tr(sp_shape_marker_get_transform_at_start(path_it->front())); + Geom::Affine tr(sp_shape_marker_get_transform_at_start(path_it->front())); if (!marker->orient_auto) { Geom::Point transl = tr.translation(); tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); @@ -629,7 +629,7 @@ void SPShape::sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker)); if (marker_item) { - Geom::Matrix tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2)); + Geom::Affine tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2)); if (!marker->orient_auto) { Geom::Point transl = tr.translation(); tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); @@ -650,7 +650,7 @@ void SPShape::sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const // END position if ( path_it != (pathv.end()-1) && !path_it->empty()) { Geom::Curve const &lastcurve = path_it->back_default(); - Geom::Matrix tr = sp_shape_marker_get_transform_at_end(lastcurve); + Geom::Affine tr = sp_shape_marker_get_transform_at_end(lastcurve); if (!marker->orient_auto) { Geom::Point transl = tr.translation(); tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); @@ -681,7 +681,7 @@ void SPShape::sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const } Geom::Curve const &lastcurve = path_last[index]; - Geom::Matrix tr = sp_shape_marker_get_transform_at_end(lastcurve); + Geom::Affine tr = sp_shape_marker_get_transform_at_end(lastcurve); if (!marker->orient_auto) { Geom::Point transl = tr.translation(); tr = Geom::Rotate::from_degrees(marker->orient) * Geom::Translate(transl); @@ -713,7 +713,7 @@ void SPShape::sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const } static void -sp_shape_print_invoke_marker_printing(SPObject* obj, Geom::Matrix tr, SPStyle* style, SPPrintContext *ctx) { +sp_shape_print_invoke_marker_printing(SPObject* obj, Geom::Affine tr, SPStyle* style, SPPrintContext *ctx) { SPMarker *marker = SP_MARKER(obj); if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { tr = Geom::Scale(style->stroke_width.computed) * tr; @@ -722,7 +722,7 @@ sp_shape_print_invoke_marker_printing(SPObject* obj, Geom::Matrix tr, SPStyle* s SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker)); tr = marker_item->transform * marker->c2p * tr; - Geom::Matrix old_tr = marker_item->transform; + Geom::Affine old_tr = marker_item->transform; marker_item->transform = tr; marker_item->invoke_print (ctx); marker_item->transform = old_tr; @@ -761,7 +761,7 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) dbox.x1 = SP_OBJECT_DOCUMENT (item)->getWidth (); dbox.y1 = SP_OBJECT_DOCUMENT (item)->getHeight (); item->getBboxDesktop (&bbox); - Geom::Matrix const i2d(item->i2d_affine()); + Geom::Affine const i2d(item->i2d_affine()); SPStyle* style = SP_OBJECT_STYLE (item); @@ -777,7 +777,7 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) // START marker for (int i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START if ( shape->marker[i] ) { - Geom::Matrix tr(sp_shape_marker_get_transform_at_start(pathv.begin()->front())); + Geom::Affine tr(sp_shape_marker_get_transform_at_start(pathv.begin()->front())); sp_shape_print_invoke_marker_printing(shape->marker[i], tr, style, ctx); } } @@ -789,7 +789,7 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) if ( path_it != pathv.begin() && ! ((path_it == (pathv.end()-1)) && (path_it->size_default() == 0)) ) // if this is the last path and it is a moveto-only, there is no mid marker there { - Geom::Matrix tr(sp_shape_marker_get_transform_at_start(path_it->front())); + Geom::Affine tr(sp_shape_marker_get_transform_at_start(path_it->front())); sp_shape_print_invoke_marker_printing(shape->marker[i], tr, style, ctx); } // MID position @@ -801,7 +801,7 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) /* Put marker between curve_it1 and curve_it2. * Loop to end_default (so including closing segment), because when a path is closed, * there should be a midpoint marker between last segment and closing straight line segment */ - Geom::Matrix tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2)); + Geom::Affine tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2)); sp_shape_print_invoke_marker_printing(shape->marker[i], tr, style, ctx); @@ -811,7 +811,7 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) } if ( path_it != (pathv.end()-1) && !path_it->empty()) { Geom::Curve const &lastcurve = path_it->back_default(); - Geom::Matrix tr = sp_shape_marker_get_transform_at_end(lastcurve); + Geom::Affine tr = sp_shape_marker_get_transform_at_end(lastcurve); sp_shape_print_invoke_marker_printing(shape->marker[i], tr, style, ctx); } } @@ -828,7 +828,7 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) } Geom::Curve const &lastcurve = path_last[index]; - Geom::Matrix tr = sp_shape_marker_get_transform_at_end(lastcurve); + Geom::Affine tr = sp_shape_marker_get_transform_at_end(lastcurve); for (int i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END if (shape->marker[i]) { @@ -1163,7 +1163,7 @@ void SPShape::sp_shape_snappoints(SPItem const *item, std::vectori2d_affine ()); + Geom::Affine const i2d (item->i2d_affine ()); if (snapprefs->getSnapObjectMidpoints()) { Geom::OptRect bbox = item->getBounds(item->i2d_affine()); -- cgit v1.2.3 From ccba415bc620a21239f11361078c8c30006106c7 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 20 Feb 2011 23:59:34 -0800 Subject: Finished cleanup of outated SP_OBJECT_DOCUMENT C macro. (bzr r10060) --- src/sp-shape.cpp | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'src/sp-shape.cpp') diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 59105a1c7..d9a47f76a 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -242,8 +242,7 @@ void SPShape::sp_shape_update(SPObject *object, SPCtx *ctx, unsigned int flags) } if (flags & (SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { - SPStyle *style; - style = SP_OBJECT_STYLE (object); + SPStyle *style = object->style; if (style->stroke_width.unit == SP_CSS_UNIT_PERCENT) { SPItemCtx *ictx = (SPItemCtx *) ctx; double const aw = 1.0 / NR::expansion(ictx->i2vp); @@ -525,7 +524,7 @@ void SPShape::sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const } case SPItem::RENDERING_BBOX: { // convert the stroke to a path and calculate that path's geometric bbox - SPStyle* style=SP_OBJECT_STYLE (item); + SPStyle* style = item->style; if (!style->stroke.isNone()) { Geom::PathVector *pathv = item_outline(item); if (pathv) { @@ -545,7 +544,7 @@ void SPShape::sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const } default: case SPItem::APPROXIMATE_BBOX: { - SPStyle* style=SP_OBJECT_STYLE (item); + SPStyle* style = item->style; if (!style->stroke.isNone()) { double const scale = transform.descrim(); if ( fabs(style->stroke_width.computed * scale) > 0.01 ) { // sinon c'est 0=oon veut pas de bord @@ -567,7 +566,7 @@ void SPShape::sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const for (unsigned i = 0; i < 2; i++) { // SP_MARKER_LOC and SP_MARKER_LOC_START if ( shape->marker[i] ) { SPMarker* marker = SP_MARKER (shape->marker[i]); - SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker)); + SPItem* marker_item = sp_item_first_item_child( marker ); if (marker_item) { Geom::Affine tr(sp_shape_marker_get_transform_at_start(pathv.begin()->front())); @@ -594,7 +593,7 @@ void SPShape::sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const for (unsigned i = 0; i < 3; i += 2) { // SP_MARKER_LOC and SP_MARKER_LOC_MID SPMarker* marker = SP_MARKER (shape->marker[i]); if ( !shape->marker[i] ) continue; - SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker)); + SPItem* marker_item = sp_item_first_item_child( marker ); if ( !marker_item ) continue; for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { @@ -626,7 +625,7 @@ void SPShape::sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const * there should be a midpoint marker between last segment and closing straight line segment */ SPMarker* marker = SP_MARKER (shape->marker[i]); - SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker)); + SPItem* marker_item = sp_item_first_item_child( marker ); if (marker_item) { Geom::Affine tr(sp_shape_marker_get_transform(*curve_it1, *curve_it2)); @@ -669,7 +668,7 @@ void SPShape::sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const for (unsigned i = 0; i < 4; i += 3) { // SP_MARKER_LOC and SP_MARKER_LOC_END if ( shape->marker[i] ) { SPMarker* marker = SP_MARKER (shape->marker[i]); - SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker)); + SPItem* marker_item = sp_item_first_item_child( marker ); if (marker_item) { /* Get reference to last curve in the path. @@ -719,7 +718,7 @@ sp_shape_print_invoke_marker_printing(SPObject* obj, Geom::Affine tr, SPStyle* s tr = Geom::Scale(style->stroke_width.computed) * tr; } - SPItem* marker_item = sp_item_first_item_child (SP_OBJECT (marker)); + SPItem* marker_item = sp_item_first_item_child( marker ); tr = marker_item->transform * marker->c2p * tr; Geom::Affine old_tr = marker_item->transform; @@ -749,7 +748,7 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) gint add_comments = prefs->getBool("/printing/debug/add-label-comments"); if (add_comments) { gchar * comment = g_strdup_printf("begin '%s'", - SP_OBJECT(item)->defaultLabel()); + item->defaultLabel()); sp_print_comment(ctx, comment); g_free(comment); } @@ -758,12 +757,12 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) item->invoke_bbox( &pbox, Geom::identity(), TRUE); dbox.x0 = 0.0; dbox.y0 = 0.0; - dbox.x1 = SP_OBJECT_DOCUMENT (item)->getWidth (); - dbox.y1 = SP_OBJECT_DOCUMENT (item)->getHeight (); + dbox.x1 = item->document->getWidth(); + dbox.y1 = item->document->getHeight(); item->getBboxDesktop (&bbox); Geom::Affine const i2d(item->i2d_affine()); - SPStyle* style = SP_OBJECT_STYLE (item); + SPStyle* style = item->style; if (!style->fill.isNone()) { sp_print_fill (ctx, pathv, &i2d, style, &pbox, &dbox, &bbox); @@ -839,7 +838,7 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) if (add_comments) { gchar * comment = g_strdup_printf("end '%s'", - SP_OBJECT(item)->defaultLabel()); + item->defaultLabel()); sp_print_comment(ctx, comment); g_free(comment); } @@ -850,7 +849,7 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) */ NRArenaItem * SPShape::sp_shape_show(SPItem *item, NRArena *arena, unsigned int /*key*/, unsigned int /*flags*/) { - SPObject *object = SP_OBJECT(item); + SPObject *object = item; SPShape *shape = SP_SHAPE(item); NRArenaItem *arenaitem = NRArenaShape::create(arena); @@ -1050,7 +1049,7 @@ sp_shape_set_marker (SPObject *object, unsigned int key, const gchar *value) return; } - SPObject *mrk = sp_css_uri_reference_resolve (SP_OBJECT_DOCUMENT (object), value); + SPObject *mrk = sp_css_uri_reference_resolve(object->document, value); if (mrk != shape->marker[key]) { if (shape->marker[key]) { SPItemView *v; @@ -1110,7 +1109,7 @@ void SPShape::setCurve(SPCurve *curve, unsigned int owner) this->curve = curve->copy(); } } - SP_OBJECT(this)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } /** -- cgit v1.2.3 From e49d12a439484bead7cf99456d7b8ccb76055f50 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 13 Mar 2011 15:25:50 +0100 Subject: make a strange cast more obvious (bzr r10101) --- src/sp-shape.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/sp-shape.cpp') diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index d9a47f76a..e9b0909ed 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -508,6 +508,8 @@ void SPShape::sp_shape_modified(SPObject *object, unsigned int flags) void SPShape::sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const &transform, unsigned const flags) { SPShape const *shape = SP_SHAPE (item); + SPItem::BBoxType bboxtype = (SPItem::BBoxType) flags; + if (shape->curve) { Geom::OptRect geombbox = bounds_exact_transformed(shape->curve->get_pathvector(), transform); if (geombbox) { @@ -517,7 +519,7 @@ void SPShape::sp_shape_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const cbbox.x1 = (*geombbox)[0][1]; cbbox.y1 = (*geombbox)[1][1]; - switch ((SPItem::BBoxType) flags) { + switch (bboxtype) { case SPItem::GEOMETRIC_BBOX: { // do nothing break; -- cgit v1.2.3 From d6978fcea4a2ccd2d9cccefabc6558a74f332a6d Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 2 Apr 2011 00:59:01 +0200 Subject: add curve before LPE to SPShape. this is useful for helperpath display. It was inspired from fixing bug 407008 Fixed bugs: - https://launchpad.net/bugs/407008 (bzr r10142) --- src/sp-shape.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src/sp-shape.cpp') diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index e9b0909ed..72559c63f 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -126,6 +126,7 @@ void SPShape::sp_shape_init(SPShape *shape) shape->marker[i] = NULL; } shape->curve = NULL; + shape->curve_before_lpe = NULL; } void SPShape::sp_shape_finalize(GObject *object) @@ -195,6 +196,9 @@ void SPShape::sp_shape_release(SPObject *object) if (shape->curve) { shape->curve = shape->curve->unref(); } + if (shape->curve_before_lpe) { + shape->curve_before_lpe = shape->curve_before_lpe->unref(); + } if (((SPObjectClass *) SPShapeClass::parent_class)->release) { ((SPObjectClass *) SPShapeClass::parent_class)->release (object); @@ -1114,6 +1118,20 @@ void SPShape::setCurve(SPCurve *curve, unsigned int owner) this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } +/** + * Sets curve_before_lpe to refer to the curve. + */ +void +SPShape::setCurveBeforeLPE (SPCurve *curve) +{ + if (this->curve_before_lpe) { + this->curve_before_lpe = this->curve_before_lpe->unref(); + } + if (curve) { + this->curve_before_lpe = curve->ref(); + } +} + /** * Return duplicate of curve (if any exists) or NULL if there is no curve */ @@ -1125,6 +1143,24 @@ SPCurve * SPShape::getCurve() return NULL; } +/** + * Return duplicate of curve *before* LPE (if any exists) or NULL if there is no curve + */ +SPCurve * +SPShape::getCurveBeforeLPE() +{ + if (sp_lpe_item_has_path_effect(SP_LPE_ITEM(this))) { + if (this->curve_before_lpe) { + return this->curve_before_lpe->copy(); + } + } else { + if (this->curve) { + return this->curve->copy(); + } + } + return NULL; +} + /** * Same as sp_shape_set_curve but without updating the display */ -- cgit v1.2.3