diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-05-09 09:37:08 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-05-09 09:37:08 +0000 |
| commit | e1db2612978dc4bca7d83ab3a4208c7523c67365 (patch) | |
| tree | c24054baf0b7d2cb0cfe862c9bf633a04c500809 /src/live_effects | |
| parent | A little bit of refactoring of constrained object snapping (diff) | |
| download | inkscape-e1db2612978dc4bca7d83ab3a4208c7523c67365.tar.gz inkscape-e1db2612978dc4bca7d83ab3a4208c7523c67365.zip | |
- try to use more forward declarations for less dependencies on display/curve.h
- change _bpath to private member of SPCurve, obtain and set with get_bpath and set_bpath.
- added const methods, so protect changes to _bpath in SPCurve
(bzr r5636)
Diffstat (limited to 'src/live_effects')
| -rw-r--r-- | src/live_effects/effect.cpp | 11 | ||||
| -rw-r--r-- | src/live_effects/effect.h | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-bendpath.cpp | 4 | ||||
| -rw-r--r-- | src/live_effects/lpe-curvestitch.cpp | 4 | ||||
| -rw-r--r-- | src/live_effects/lpe-knot.cpp | 8 | ||||
| -rw-r--r-- | src/live_effects/lpe-perspective_path.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-skeleton.cpp | 18 | ||||
| -rw-r--r-- | src/live_effects/lpe-skeleton.h | 1 | ||||
| -rw-r--r-- | src/live_effects/lpe-sketch.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-slant.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-spiro.cpp | 2 | ||||
| -rw-r--r-- | src/live_effects/lpe-vonkoch.cpp | 7 | ||||
| -rw-r--r-- | src/live_effects/lpegroupbbox.cpp | 3 | ||||
| -rw-r--r-- | src/live_effects/parameter/path-reference.cpp | 10 |
14 files changed, 8 insertions, 68 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp index 2cd88fd8b..f699248e4 100644 --- a/src/live_effects/effect.cpp +++ b/src/live_effects/effect.cpp @@ -164,18 +164,13 @@ Effect::doBeforeEffect (SPLPEItem */*lpeitem*/) void Effect::doEffect (SPCurve * curve) { - NArtBpath *new_bpath = doEffect_nartbpath(SP_CURVE_BPATH(curve)); + NArtBpath *new_bpath = doEffect_nartbpath(curve->get_bpath()); - if (new_bpath && new_bpath != SP_CURVE_BPATH(curve)) { // FIXME, add function to SPCurve to change bpath? or a copy function? - if (curve->_bpath) { - g_free(curve->_bpath); //delete old bpath - } - curve->_bpath = new_bpath; - } + curve->set_bpath(new_bpath); } NArtBpath * -Effect::doEffect_nartbpath (NArtBpath * path_in) +Effect::doEffect_nartbpath (NArtBpath const * path_in) { try { std::vector<Geom::Path> orig_pathv = BPath_to_2GeomPath(path_in); diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h index 58010358f..7ab4537f9 100644 --- a/src/live_effects/effect.h +++ b/src/live_effects/effect.h @@ -112,7 +112,7 @@ protected: // called by this base class. (i.e. doEffect(SPCurve * curve) defaults to calling // doEffect(std::vector<Geom::Path> ) virtual NArtBpath * - doEffect_nartbpath (NArtBpath * path_in); + doEffect_nartbpath (NArtBpath const * path_in) __attribute__ ((deprecated)); virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in); virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > diff --git a/src/live_effects/lpe-bendpath.cpp b/src/live_effects/lpe-bendpath.cpp index c37f34ce7..6b9fbbb97 100644 --- a/src/live_effects/lpe-bendpath.cpp +++ b/src/live_effects/lpe-bendpath.cpp @@ -12,9 +12,7 @@ #include "sp-item.h" #include "sp-path.h" #include "sp-item-group.h" -#include "display/curve.h" -#include <libnr/n-art-bpath.h> -#include <libnr/nr-matrix-fns.h> +//#include <libnr/n-art-bpath.h> #include "libnr/n-art-bpath-2geom.h" #include "svg/svg.h" #include "ui/widget/scalar.h" diff --git a/src/live_effects/lpe-curvestitch.cpp b/src/live_effects/lpe-curvestitch.cpp index 22f20b820..9cf9f2f26 100644 --- a/src/live_effects/lpe-curvestitch.cpp +++ b/src/live_effects/lpe-curvestitch.cpp @@ -14,8 +14,7 @@ */ #include "live_effects/lpe-curvestitch.h" -#include "display/curve.h" -#include <libnr/n-art-bpath.h> + #include "sp-item.h" #include "sp-path.h" #include "libnr/n-art-bpath-2geom.h" @@ -30,7 +29,6 @@ #include <2geom/d2.h> #include <2geom/matrix.h> - #include "ui/widget/scalar.h" #include "libnr/nr-values.h" diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp index 245b6df0f..5ac4a98d4 100644 --- a/src/live_effects/lpe-knot.cpp +++ b/src/live_effects/lpe-knot.cpp @@ -12,17 +12,9 @@ */ #include "live_effects/lpe-knot.h" -#include "display/curve.h" -#include <libnr/n-art-bpath.h> #include <2geom/path.h> -//#include <2geom/sbasis.h> -//#include <2geom/sbasis-geometric.h> -//#include <2geom/bezier-to-sbasis.h> -//#include <2geom/sbasis-to-bezier.h> #include <2geom/d2.h> -//#include <2geom/sbasis-math.h> -//#include <2geom/piecewise.h> #include <2geom/crossing.h> #include <2geom/path-intersection.h> diff --git a/src/live_effects/lpe-perspective_path.cpp b/src/live_effects/lpe-perspective_path.cpp index 5be5970c1..57bc458a9 100644 --- a/src/live_effects/lpe-perspective_path.cpp +++ b/src/live_effects/lpe-perspective_path.cpp @@ -26,8 +26,6 @@ #include "document.h" #include "live_effects/lpe-perspective_path.h" -#include "display/curve.h" -#include <libnr/n-art-bpath.h> #include "sp-item-group.h" #include "inkscape.h" diff --git a/src/live_effects/lpe-skeleton.cpp b/src/live_effects/lpe-skeleton.cpp index 571503d8e..04d61bd73 100644 --- a/src/live_effects/lpe-skeleton.cpp +++ b/src/live_effects/lpe-skeleton.cpp @@ -20,8 +20,6 @@ */ #include "live_effects/lpe-skeleton.h" -#include "display/curve.h" -#include <libnr/n-art-bpath.h> // You might need to include other 2geom files. You can add them here: #include <2geom/path.h> @@ -55,22 +53,6 @@ LPESkeleton::doEffect (SPCurve * curve) // spice this up to make the effect actually *do* something! } -NArtBpath * -LPESkeleton::doEffect_nartbpath (NArtBpath * path_in) -{ - NArtBpath *path_out; - unsigned ret = 0; - while ( path_in[ret].code != NR_END ) { - ++ret; - } - unsigned len = ++ret; - path_out = g_new(NArtBpath, len); - - memcpy(path_out, path_in, len * sizeof(NArtBpath)); // spice this up to make the effect actually *do* something! - - return path_out; -} - std::vector<Geom::Path> LPESkeleton::doEffect_path (std::vector<Geom::Path> & path_in) { diff --git a/src/live_effects/lpe-skeleton.h b/src/live_effects/lpe-skeleton.h index 290b8a724..6522e9ca3 100644 --- a/src/live_effects/lpe-skeleton.h +++ b/src/live_effects/lpe-skeleton.h @@ -28,7 +28,6 @@ public: // Choose to implement one of the doEffect functions. You can delete or comment out the others. // virtual void doEffect (SPCurve * curve); -// virtual NArtBpath * doEffect_nartbpath (NArtBpath * path_in); // virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> & path_in); virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in); diff --git a/src/live_effects/lpe-sketch.cpp b/src/live_effects/lpe-sketch.cpp index 4fc6fc35d..d03200941 100644 --- a/src/live_effects/lpe-sketch.cpp +++ b/src/live_effects/lpe-sketch.cpp @@ -12,8 +12,6 @@ */ #include "live_effects/lpe-sketch.h" -#include "display/curve.h" -#include <libnr/n-art-bpath.h> // You might need to include other 2geom files. You can add them here: #include <2geom/path.h> diff --git a/src/live_effects/lpe-slant.cpp b/src/live_effects/lpe-slant.cpp index 407e43992..7382d15e2 100644 --- a/src/live_effects/lpe-slant.cpp +++ b/src/live_effects/lpe-slant.cpp @@ -29,7 +29,7 @@ LPESlant::~LPESlant() void LPESlant::doEffect(SPCurve * curve) { - NArtBpath *bpath = curve->_bpath; + NArtBpath *bpath = curve->get_bpath(); int i = 0; while(bpath[i].code != NR_END) { bpath[i].y1 += (bpath[i].x1-center[Geom::X]) * factor; diff --git a/src/live_effects/lpe-spiro.cpp b/src/live_effects/lpe-spiro.cpp index a193b1a0a..6994b684b 100644 --- a/src/live_effects/lpe-spiro.cpp +++ b/src/live_effects/lpe-spiro.cpp @@ -99,7 +99,7 @@ LPESpiro::doEffect(SPCurve * curve) bezctx *bc = new_bezctx_ink(curve); int len = SP_CURVE_LENGTH(csrc); spiro_cp *path = g_new (spiro_cp, len + 1); - NArtBpath *bpath = csrc->_bpath; + NArtBpath *bpath = csrc->get_bpath(); int ib = 0; int ip = 0; bool closed = false; diff --git a/src/live_effects/lpe-vonkoch.cpp b/src/live_effects/lpe-vonkoch.cpp index 088d576b1..ee09221ed 100644 --- a/src/live_effects/lpe-vonkoch.cpp +++ b/src/live_effects/lpe-vonkoch.cpp @@ -9,13 +9,6 @@ #include <cstdio> #include "live_effects/lpe-vonkoch.h" -#include "sp-shape.h" -#include "sp-item.h" -#include "sp-path.h" -#include "display/curve.h" -#include <libnr/n-art-bpath.h> -#include <libnr/nr-matrix-fns.h> -#include "libnr/n-art-bpath-2geom.h" #include "svg/svg.h" #include "ui/widget/scalar.h" #include "nodepath.h" diff --git a/src/live_effects/lpegroupbbox.cpp b/src/live_effects/lpegroupbbox.cpp index 588d3ec0f..50f7599c0 100644 --- a/src/live_effects/lpegroupbbox.cpp +++ b/src/live_effects/lpegroupbbox.cpp @@ -11,9 +11,6 @@ #include "sp-item.h" #include "sp-path.h" #include "sp-item-group.h" -#include "display/curve.h" -#include <libnr/n-art-bpath.h> -#include <libnr/nr-matrix-fns.h> #include "libnr/n-art-bpath-2geom.h" #include "svg/svg.h" #include "ui/widget/scalar.h" diff --git a/src/live_effects/parameter/path-reference.cpp b/src/live_effects/parameter/path-reference.cpp index 78f270e64..a76fb1b32 100644 --- a/src/live_effects/parameter/path-reference.cpp +++ b/src/live_effects/parameter/path-reference.cpp @@ -8,18 +8,8 @@ #include "live_effects/parameter/path-reference.h" -#include <cstring> -#include <string> -#include <string.h> - -#include "enums.h" - -#include "display/curve.h" -#include "livarot/Path.h" -#include "prefs-utils.h" #include "sp-shape.h" #include "sp-text.h" -#include "uri.h" namespace Inkscape { namespace LivePathEffect { |
