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