diff options
| author | Liam P. White <inkscapebronyat-signgmaildotcom> | 2014-06-07 01:19:18 +0000 |
|---|---|---|
| committer | Liam P. White <inkscapebronyat-signgmaildotcom> | 2014-06-07 01:19:18 +0000 |
| commit | 48ddc5ea8c9ee44c7ae388d43f9be9552acf64ae (patch) | |
| tree | 9e66e429e2025fb99b28511231f87c533c15e865 /src | |
| parent | Clean up some unnecessary pointer usage in livarot (diff) | |
| download | inkscape-48ddc5ea8c9ee44c7ae388d43f9be9552acf64ae.tar.gz inkscape-48ddc5ea8c9ee44c7ae388d43f9be9552acf64ae.zip | |
Undo changes in r13391
(bzr r13341.1.51)
Diffstat (limited to 'src')
| -rw-r--r-- | src/livarot/Path.h | 12 | ||||
| -rw-r--r-- | src/livarot/PathConversion.cpp | 3 | ||||
| -rw-r--r-- | src/livarot/PathCutting.cpp | 7 | ||||
| -rw-r--r-- | src/livarot/PathOutline.cpp | 9 | ||||
| -rw-r--r-- | src/livarot/PathStroke.cpp | 3 | ||||
| -rw-r--r-- | src/sp-flowregion.cpp | 3 | ||||
| -rw-r--r-- | src/sp-offset.cpp | 22 | ||||
| -rw-r--r-- | src/splivarot.cpp | 48 | ||||
| -rw-r--r-- | src/ui/tools/flood-tool.cpp | 2 | ||||
| -rw-r--r-- | src/ui/tools/pencil-tool.cpp | 5 | ||||
| -rw-r--r-- | src/ui/tools/tweak-tool.cpp | 2 |
11 files changed, 55 insertions, 61 deletions
diff --git a/src/livarot/Path.h b/src/livarot/Path.h index 5d5a24e5a..32ee71ffc 100644 --- a/src/livarot/Path.h +++ b/src/livarot/Path.h @@ -135,26 +135,26 @@ public: // closeIfNeeded=false prevent the function from closing the path (resulting in a non-eulerian graph // pathID is a identification number for the path, and is used for recomposing curves from polylines // give each different Path a different ID, and feed the appropriate orig[] to the ConvertToForme() function - void Fill(Shape &dest, int pathID = -1, bool justAdd = false, + void Fill(Shape *dest, int pathID = -1, bool justAdd = false, bool closeIfNeeded = true, bool invert = false); // - stroke the path; usual parameters: type of cap=butt, type of join=join and miter (see LivarotDefs.h) // doClose treat the path as closed (ie a loop) - void Stroke(Shape &dest, bool doClose, double width, JoinType join, + void Stroke(Shape *dest, bool doClose, double width, JoinType join, ButtType butt, double miter, bool justAdd = false); // build a Path that is the outline of the Path instance's description (the result is stored in dest) // it doesn't compute the exact offset (it's way too complicated, but an approximation made of cubic bezier patches // and segments. the algorithm was found in a plugin for Impress (by Chris Cox), but i can't find it back... - void Outline(Path &dest, double width, JoinType join, ButtType butt, + void Outline(Path *dest, double width, JoinType join, ButtType butt, double miter); // half outline with edges having the same direction as the original - void OutsideOutline(Path &dest, double width, JoinType join, ButtType butt, + void OutsideOutline(Path *dest, double width, JoinType join, ButtType butt, double miter); // half outline with edges having the opposite direction as the original - void InsideOutline (Path & dest, double width, JoinType join, ButtType butt, + void InsideOutline (Path * dest, double width, JoinType join, ButtType butt, double miter); // polyline to cubic bezier patches @@ -184,7 +184,7 @@ public: void LoadPath(Geom::Path const &path, Geom::Affine const &tr, bool doTransformation, bool append = false); void LoadPathVector(Geom::PathVector const &pv, Geom::Affine const &tr, bool doTransformation); void LoadPathVector(Geom::PathVector const &pv); - Geom::PathVector MakePathVector(); + Geom::PathVector* MakePathVector(); void Transform(const Geom::Affine &trans); diff --git a/src/livarot/PathConversion.cpp b/src/livarot/PathConversion.cpp index 0ef88841a..42df898e6 100644 --- a/src/livarot/PathConversion.cpp +++ b/src/livarot/PathConversion.cpp @@ -1269,9 +1269,8 @@ void Path::RecBezierTo(Geom::Point const &iP, Geom::Point const &iS,Geom::Point * in a path description ( you need to have prepared the back data for that, of course) */ -void Path::Fill(Shape& destr, int pathID, bool justAdd, bool closeIfNeeded, bool invert) +void Path::Fill(Shape* dest, int pathID, bool justAdd, bool closeIfNeeded, bool invert) { - Shape* dest = &destr; if ( dest == NULL ) { return; } diff --git a/src/livarot/PathCutting.cpp b/src/livarot/PathCutting.cpp index 74653ca06..49b2c5a78 100644 --- a/src/livarot/PathCutting.cpp +++ b/src/livarot/PathCutting.cpp @@ -269,11 +269,10 @@ void Path::DashSubPath(int spL, int spP, std::vector<path_lineto> const &orig_pt } } -Geom::PathVector +Geom::PathVector * Path::MakePathVector() { - Geom::PathVector retPv; - Geom::PathVector *pv = &retPv; + Geom::PathVector *pv = new Geom::PathVector(); Geom::Path * currentpath = NULL; Geom::Point lastP,bezSt,bezEn; @@ -381,7 +380,7 @@ Path::MakePathVector() } } - return *pv; + return pv; } void Path::AddCurve(Geom::Curve const &c) diff --git a/src/livarot/PathOutline.cpp b/src/livarot/PathOutline.cpp index f1978931a..211ee31e2 100644 --- a/src/livarot/PathOutline.cpp +++ b/src/livarot/PathOutline.cpp @@ -21,9 +21,8 @@ // outline of a path. // computed by making 2 offsets, one of the "left" side of the path, one of the right side, and then glueing the two // the left side has to be reversed to make a contour -void Path::Outline(Path &destr, double width, JoinType join, ButtType butt, double miter) +void Path::Outline(Path *dest, double width, JoinType join, ButtType butt, double miter) { - ::Path * dest = &destr; if ( descr_flags & descr_adding_bezier ) { CancelBezier(); } @@ -199,10 +198,9 @@ void Path::Outline(Path &destr, double width, JoinType join, ButtType butt, doub // versions for outlining closed path: they only make one side of the offset contour void -Path::OutsideOutline (Path & destr, double width, JoinType join, ButtType butt, +Path::OutsideOutline (Path * dest, double width, JoinType join, ButtType butt, double miter) { - ::Path * dest = &destr; if (descr_flags & descr_adding_bezier) { CancelBezier(); } @@ -225,10 +223,9 @@ Path::OutsideOutline (Path & destr, double width, JoinType join, ButtType butt, } void -Path::InsideOutline (Path & destr, double width, JoinType join, ButtType butt, +Path::InsideOutline (Path * dest, double width, JoinType join, ButtType butt, double miter) { - ::Path * dest = &destr; if ( descr_flags & descr_adding_bezier ) { CancelBezier(); } diff --git a/src/livarot/PathStroke.cpp b/src/livarot/PathStroke.cpp index 07ecc8114..50c335176 100644 --- a/src/livarot/PathStroke.cpp +++ b/src/livarot/PathStroke.cpp @@ -38,10 +38,9 @@ static Geom::Point StrokeNormalize(const Geom::Point value, double length) { } } -void Path::Stroke(Shape &destr, bool doClose, double width, JoinType join, +void Path::Stroke(Shape *dest, bool doClose, double width, JoinType join, ButtType butt, double miter, bool justAdd) { - ::Shape* dest = &destr; if (dest == NULL) { return; } diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp index 37170c9e6..709e9e464 100644 --- a/src/sp-flowregion.cpp +++ b/src/sp-flowregion.cpp @@ -1,5 +1,4 @@ /* - * TODO: clean this up */ #ifdef HAVE_CONFIG_H @@ -383,7 +382,7 @@ static void GetDest(SPObject* child,Shape **computed) temp->LoadPathVector(curve->get_pathvector(), tr_mat, true); Shape* n_shp=new Shape; temp->Convert(0.25); - temp->Fill(*n_shp,0); + temp->Fill(n_shp,0); Shape* uncross=new Shape; SPStyle* style = u_child->style; if ( style && style->fill_rule.computed == SP_WIND_RULE_EVENODD ) { diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp index 26eb64c94..c6a4b730d 100644 --- a/src/sp-offset.cpp +++ b/src/sp-offset.cpp @@ -406,12 +406,12 @@ void SPOffset::set_shape() { if (this->rad >= 0) { o_width = this->rad; - orig->OutsideOutline (*res, o_width, join_round, butt_straight, 20.0); + orig->OutsideOutline (res, o_width, join_round, butt_straight, 20.0); } else { o_width = -this->rad; - orig->OutsideOutline (*res, -o_width, join_round, butt_straight, 20.0); + orig->OutsideOutline (res, -o_width, join_round, butt_straight, 20.0); } if (o_width >= 1.0) @@ -424,7 +424,7 @@ void SPOffset::set_shape() { // res->ConvertForOffset (o_width, orig, offset->rad); res->ConvertWithBackData (o_width); } - res->Fill (*theShape, 0); + res->Fill (theShape, 0); theRes->ConvertToShape (theShape, fill_positive); originaux[0] = res; @@ -489,7 +489,7 @@ void SPOffset::set_shape() { orig->ConvertWithBackData (0.5*o_width); } - orig->Fill (*theShape, 0); + orig->Fill (theShape, 0); theRes->ConvertToShape (theShape, fill_positive); Path *originaux[1]; @@ -527,7 +527,7 @@ void SPOffset::set_shape() { if ( partSurf < 0 ) { // inverse par rapport a la realite // plein holes[i]=0; - parts[i]->Fill(*oneCleanPart, 0); + parts[i]->Fill(oneCleanPart,0); onePart->ConvertToShape(oneCleanPart,fill_positive); // there aren't intersections in that one, but maybe duplicate points and null edges oneCleanPart->MakeOffset(onePart,this->rad,join_round,20.0); onePart->ConvertToShape(oneCleanPart,fill_positive); @@ -564,7 +564,7 @@ void SPOffset::set_shape() { } else { // trou holes[i]=1; - parts[i]->Fill(*oneCleanPart, 0, false, true, true); + parts[i]->Fill(oneCleanPart,0,false,true,true); onePart->ConvertToShape(oneCleanPart,fill_positive); oneCleanPart->MakeOffset(onePart,-this->rad,join_round,20.0); onePart->ConvertToShape(oneCleanPart,fill_positive); @@ -614,9 +614,9 @@ void SPOffset::set_shape() { parts[i]->ConvertWithBackData(1.0); if ( holes[i] ) { - parts[i]->Fill(*theShape,i,true,true,true); + parts[i]->Fill(theShape,i,true,true,true); } else { - parts[i]->Fill(*theShape,i,true,true,false); + parts[i]->Fill(theShape,i,true,true,false); } } } @@ -808,7 +808,7 @@ sp_offset_distance_to_original (SPOffset * offset, Geom::Point px) */ // move ((Path *) offset->originalPath)->Convert (1.0); - ((Path *) offset->originalPath)->Fill (*theShape, 0); + ((Path *) offset->originalPath)->Fill (theShape, 0); theRes->ConvertToShape (theShape, fill_oddEven); if (theRes->numberOfEdges() <= 1) @@ -987,7 +987,7 @@ sp_offset_top_point (SPOffset const * offset, Geom::Point *px) Shape *theShape = new Shape; finalPath->Convert (1.0); - finalPath->Fill (*theShape, 0); + finalPath->Fill (theShape, 0); if (theShape->hasPoints()) { @@ -1174,7 +1174,7 @@ refresh_offset_source(SPOffset* offset) Shape *theRes = new Shape; orig->ConvertWithBackData (1.0); - orig->Fill (*theShape, 0); + orig->Fill (theShape, 0); css = sp_repr_css_attr (offset->sourceRepr , "style"); val = sp_repr_css_property (css, "fill-rule", NULL); diff --git a/src/splivarot.cpp b/src/splivarot.cpp index c8682e6b4..8bb2a7150 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -156,13 +156,13 @@ sp_pathvector_boolop(Geom::PathVector const &pathva, Geom::PathVector const &pat // get the polygons of each path, with the winding rule specified, and apply the operation iteratively originaux[0]->ConvertWithBackData(0.1); - originaux[0]->Fill(*theShape, 0); + originaux[0]->Fill(theShape, 0); theShapeA->ConvertToShape(theShape, origWind[0]); originaux[1]->ConvertWithBackData(0.1); - originaux[1]->Fill(*theShape, 1); + originaux[1]->Fill(theShape, 1); theShapeB->ConvertToShape(theShape, origWind[1]); @@ -191,13 +191,13 @@ sp_pathvector_boolop(Geom::PathVector const &pathva, Geom::PathVector const &pat } originaux[0]->ConvertWithBackData(1.0); - originaux[0]->Fill(*theShape, 0); + originaux[0]->Fill(theShape, 0); theShapeA->ConvertToShape(theShape, origWind[0]); originaux[1]->ConvertWithBackData(1.0); - originaux[1]->Fill(*theShape, 1,false,false,false); //do not closeIfNeeded + originaux[1]->Fill(theShape, 1,false,false,false); //do not closeIfNeeded theShapeB->ConvertToShape(theShape, fill_justDont); // fill_justDont doesn't computes winding numbers @@ -218,11 +218,11 @@ sp_pathvector_boolop(Geom::PathVector const &pathva, Geom::PathVector const &pat } originaux[0]->ConvertWithBackData(1.0); - originaux[0]->Fill(*theShapeA, 0,false,false,false); // don't closeIfNeeded + originaux[0]->Fill(theShapeA, 0,false,false,false); // don't closeIfNeeded originaux[1]->ConvertWithBackData(1.0); - originaux[1]->Fill(*theShapeA, 1,true,false,false);// don't closeIfNeeded and just dump in the shape, don't reset it + originaux[1]->Fill(theShapeA, 1,true,false,false);// don't closeIfNeeded and just dump in the shape, don't reset it theShape->ConvertToShape(theShapeA, fill_justDont); @@ -467,7 +467,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool // get the polygons of each path, with the winding rule specified, and apply the operation iteratively originaux[0]->ConvertWithBackData(0.1); - originaux[0]->Fill(*theShape, 0); + originaux[0]->Fill(theShape, 0); theShapeA->ConvertToShape(theShape, origWind[0]); @@ -475,7 +475,7 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool for (GSList *l = il->next; l != NULL; l = l->next) { originaux[curOrig]->ConvertWithBackData(0.1); - originaux[curOrig]->Fill(*theShape, curOrig); + originaux[curOrig]->Fill(theShape, curOrig); theShapeB->ConvertToShape(theShape, origWind[curOrig]); @@ -549,16 +549,16 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool } originaux[0]->ConvertWithBackData(1.0); - originaux[0]->Fill(*theShape, 0); + originaux[0]->Fill(theShape, 0); theShapeA->ConvertToShape(theShape, origWind[0]); originaux[1]->ConvertWithBackData(1.0); if ((originaux[1]->pts.size() == 2) && originaux[1]->pts[0].isMoveTo && !originaux[1]->pts[1].isMoveTo) - originaux[1]->Fill(*theShape, 1,false,true,false); // see LP Bug 177956 + originaux[1]->Fill(theShape, 1,false,true,false); // see LP Bug 177956 else - originaux[1]->Fill(*theShape, 1,false,false,false); //do not closeIfNeeded + originaux[1]->Fill(theShape, 1,false,false,false); //do not closeIfNeeded theShapeB->ConvertToShape(theShape, fill_justDont); // fill_justDont doesn't computes winding numbers @@ -579,11 +579,11 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool } originaux[0]->ConvertWithBackData(1.0); - originaux[0]->Fill(*theShapeA, 0,false,false,false); // don't closeIfNeeded + originaux[0]->Fill(theShapeA, 0,false,false,false); // don't closeIfNeeded originaux[1]->ConvertWithBackData(1.0); - originaux[1]->Fill(*theShapeA, 1,true,false,false);// don't closeIfNeeded and just dump in the shape, don't reset it + originaux[1]->Fill(theShapeA, 1,true,false,false);// don't closeIfNeeded and just dump in the shape, don't reset it theShape->ConvertToShape(theShapeA, fill_justDont); @@ -1014,9 +1014,9 @@ Geom::PathVector* item_outline(SPItem const *item, bool bbox_only) orig->DashPolylineFromStyle(i_style, scale, 0); Shape* theShape = new Shape; - orig->Stroke(*theShape, false, 0.5*o_width, o_join, o_butt, + orig->Stroke(theShape, false, 0.5*o_width, o_join, o_butt, 0.5 * o_miter); - orig->Outline(*res, 0.5 * o_width, o_join, o_butt, 0.5 * o_miter); + orig->Outline(res, 0.5 * o_width, o_join, o_butt, 0.5 * o_miter); if (!bbox_only) { Shape *theRes = new Shape; @@ -1030,7 +1030,7 @@ Geom::PathVector* item_outline(SPItem const *item, bool bbox_only) } delete theShape; } else { - orig->Outline(*res, 0.5 * o_width, o_join, o_butt, 0.5 * o_miter); + orig->Outline(res, 0.5 * o_width, o_join, o_butt, 0.5 * o_miter); if (!bbox_only) { orig->Coalesce(0.5 * o_width); @@ -1038,7 +1038,7 @@ Geom::PathVector* item_outline(SPItem const *item, bool bbox_only) Shape *theRes = new Shape; res->ConvertWithBackData(1.0); - res->Fill(*theShape, 0); + res->Fill(theShape, 0); theRes->ConvertToShape(theShape, fill_positive); Path *originaux[1]; @@ -1060,7 +1060,7 @@ Geom::PathVector* item_outline(SPItem const *item, bool bbox_only) if (res->descr_cmd.size() > 1) { // if there's 0 or 1 node left, drop this path altogether - ret_pathv = new Geom::PathVector(bbox_only ? (res->MakePathVector()) : (orig->MakePathVector())); + ret_pathv = bbox_only ? res->MakePathVector() : orig->MakePathVector(); if (SP_IS_SHAPE(item) && SP_SHAPE(item)->hasMarkers() && !bbox_only) { SPShape *shape = SP_SHAPE(item); @@ -1283,9 +1283,9 @@ sp_selected_path_outline(SPDesktop *desktop) orig->DashPolylineFromStyle(i_style, scale, 0); Shape* theShape = new Shape; - orig->Stroke(*theShape, false, 0.5*o_width, o_join, o_butt, + orig->Stroke(theShape, false, 0.5*o_width, o_join, o_butt, 0.5 * o_miter); - orig->Outline(*res, 0.5 * o_width, o_join, o_butt, 0.5 * o_miter); + orig->Outline(res, 0.5 * o_width, o_join, o_butt, 0.5 * o_miter); Shape *theRes = new Shape; @@ -1302,7 +1302,7 @@ sp_selected_path_outline(SPDesktop *desktop) } else { - orig->Outline(*res, 0.5 * o_width, o_join, o_butt, 0.5 * o_miter); + orig->Outline(res, 0.5 * o_width, o_join, o_butt, 0.5 * o_miter); orig->Coalesce(0.5 * o_width); @@ -1310,7 +1310,7 @@ sp_selected_path_outline(SPDesktop *desktop) Shape *theRes = new Shape; res->ConvertWithBackData(1.0); - res->Fill(*theShape, 0); + res->Fill(theShape, 0); theRes->ConvertToShape(theShape, fill_positive); Path *originaux[1]; @@ -1644,7 +1644,7 @@ void sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool Shape *theRes = new Shape; orig->ConvertWithBackData(1.0); - orig->Fill(*theShape, 0); + orig->Fill(theShape, 0); SPCSSAttr *css = sp_repr_css_attr(item->getRepr(), "style"); gchar const *val = sp_repr_css_property(css, "fill-rule", NULL); @@ -1843,7 +1843,7 @@ sp_selected_path_do_offset(SPDesktop *desktop, bool expand, double prefOffset) Shape *theRes = new Shape; orig->ConvertWithBackData(0.03); - orig->Fill(*theShape, 0); + orig->Fill(theShape, 0); SPCSSAttr *css = sp_repr_css_attr(item->getRepr(), "style"); gchar const *val = sp_repr_css_property(css, "fill-rule", NULL); diff --git a/src/ui/tools/flood-tool.cpp b/src/ui/tools/flood-tool.cpp index 15bc7164c..d74848dc6 100644 --- a/src/ui/tools/flood-tool.cpp +++ b/src/ui/tools/flood-tool.cpp @@ -408,7 +408,7 @@ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *deskto Shape *path_shape = new Shape(); path->ConvertWithBackData(0.03); - path->Fill(*path_shape, 0); + path->Fill(path_shape, 0); delete path; Shape *expanded_path_shape = new Shape(); diff --git a/src/ui/tools/pencil-tool.cpp b/src/ui/tools/pencil-tool.cpp index 48f8c3a28..0e8660248 100644 --- a/src/ui/tools/pencil-tool.cpp +++ b/src/ui/tools/pencil-tool.cpp @@ -760,8 +760,9 @@ void PencilTool::_sketchInterpolate() { path.LoadPathVector(Geom::path_from_piecewise(this->sketch_interpolation, 0.01)); path.Simplify(0.5); - Geom::PathVector pathv = path.MakePathVector(); - this->sketch_interpolation = pathv[0].toPwSb(); + Geom::PathVector *pathv = path.MakePathVector(); + this->sketch_interpolation = (*pathv)[0].toPwSb(); + delete pathv; } else { this->sketch_interpolation = fit_pwd2; } diff --git a/src/ui/tools/tweak-tool.cpp b/src/ui/tools/tweak-tool.cpp index bc1519773..75650d3af 100644 --- a/src/ui/tools/tweak-tool.cpp +++ b/src/ui/tools/tweak-tool.cpp @@ -551,7 +551,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P Geom::Affine i2doc(item->i2doc_affine()); orig->ConvertWithBackData((0.08 - (0.07 * fidelity)) / i2doc.descrim()); // default 0.059 - orig->Fill(*theShape, 0); + orig->Fill(theShape, 0); SPCSSAttr *css = sp_repr_css_attr(item->getRepr(), "style"); gchar const *val = sp_repr_css_property(css, "fill-rule", NULL); |
