summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6be138f)
raw | patch | inline | side by side (parent: 6be138f)
| author | mental <mental@users.sourceforge.net> | |
| Tue, 9 May 2006 03:52:58 +0000 (03:52 +0000) | ||
| committer | mental <mental@users.sourceforge.net> | |
| Tue, 9 May 2006 03:52:58 +0000 (03:52 +0000) |
19 files changed:
diff --git a/ChangeLog b/ChangeLog
index d267a6fa494ac4c28ccac50667d4a05282564c12..fc04c8467101f20329433d741bdaf874fc659aa9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2006-05-08 MenTaLguY <mental@rydia.net>
+
+ * src/display/canvas-bpath.cpp, src/display/curve.cpp, src/display/curve.h,
+ src/display/nr-arena-shape.cpp, src/draw-context.cpp,
+ src/extension/internal/odf.cpp, src/extension/internal/pov-out.cpp,
+ src/nodepath.cpp, src/object-snapper.cpp, src/path-chemistry.cpp,
+ src/sp-flowregion.cpp, src/splivarot.cpp, src/sp-offset.cpp,
+ src/sp-path.cpp, src/sp-shape.cpp, src/sp-spiral.cpp, src/sp-star.cpp,
+ src/sp-use-reference.cpp:
+
+ eliminate direct accesses to SPCurve::bpath
+
2006-05-08 MenTaLguY <mental@rydia.net>
* src/streams-zlib.cpp, src/streams-jar.cpp, src/splivarot.cpp,
index d85f777857147b70991852d9ac8cd8ead54856d1..a9285f95234aa9cc1ff7d7893959a3472c67cda2 100644 (file)
@@ -140,7 +140,7 @@ sp_canvas_bpath_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned i
if ((cbp->fill_rgba & 0xff) || (cbp->stroke_rgba & 0xff)) {
Path* thePath=new Path;
- thePath->LoadArtBPath(cbp->curve->bpath, affine, true);
+ thePath->LoadArtBPath(SP_CANVAS_BPATH(cbp->curve), affine, true);
thePath->Convert(0.25);
if ((cbp->fill_rgba & 0xff) && (cbp->curve->end > 2)) {
Shape* theShape=new Shape;
diff --git a/src/display/curve.cpp b/src/display/curve.cpp
index a8a6e354e38b06d489c944529e2c7149a122069a..3ea4e60dfd7756fa51b65a2256805a21d906d952 100644 (file)
--- a/src/display/curve.cpp
+++ b/src/display/curve.cpp
SPCurve *curve = g_new(SPCurve, 1);
curve->refcount = 1;
- curve->bpath = nr_new(NArtBpath, length);
- curve->bpath->code = NR_END;
+ curve->_bpath = nr_new(NArtBpath, length);
+ curve->_bpath->code = NR_END;
curve->end = 0;
curve->length = length;
curve->substart = 0;
SPCurve *curve = g_new(SPCurve, 1);
curve->refcount = 1;
- curve->bpath = bpath;
+ curve->_bpath = bpath;
curve->length = sp_bpath_length(bpath);
curve->end = curve->length - 1;
gint i = curve->end;
for (; i > 0; i--)
- if ((curve->bpath[i].code == NR_MOVETO) ||
- (curve->bpath[i].code == NR_MOVETO_OPEN))
+ if ((curve->_bpath[i].code == NR_MOVETO) ||
+ (curve->_bpath[i].code == NR_MOVETO_OPEN))
break;
curve->substart = i;
curve->sbpath = false;
SPCurve *curve = g_new(SPCurve, 1);
curve->refcount = 1;
- curve->bpath = const_cast<NArtBpath *>(bpath);
+ curve->_bpath = const_cast<NArtBpath *>(bpath);
curve->length = sp_bpath_length(bpath);
curve->end = curve->length - 1;
gint i = curve->end;
for (; i > 0; i--)
- if ((curve->bpath[i].code == NR_MOVETO) ||
- (curve->bpath[i].code == NR_MOVETO_OPEN))
+ if ((curve->_bpath[i].code == NR_MOVETO) ||
+ (curve->_bpath[i].code == NR_MOVETO_OPEN))
break;
curve->substart = i;
curve->sbpath = sbpath;
curve->refcount -= 1;
if (curve->refcount < 1) {
- if ((!curve->sbpath) && (curve->bpath)) {
- nr_free(curve->bpath);
+ if ((!curve->sbpath) && (curve->_bpath)) {
+ nr_free(curve->_bpath);
}
g_free(curve);
}
if (space < SP_CURVE_LENSTEP)
space = SP_CURVE_LENSTEP;
- curve->bpath = nr_renew(curve->bpath, NArtBpath, curve->length + space);
+ curve->_bpath = nr_renew(curve->_bpath, NArtBpath, curve->length + space);
curve->length += space;
}
{
g_return_val_if_fail(curve != NULL, NULL);
- return sp_curve_new_from_foreign_bpath(curve->bpath);
+ return sp_curve_new_from_foreign_bpath(curve->_bpath);
}
/**
SPCurve *new_curve = sp_curve_new_sized(length + 1);
- NArtBpath *bp = new_curve->bpath;
+ NArtBpath *bp = new_curve->_bpath;
for (GSList const *l = list; l != NULL; l = l->next) {
SPCurve *c = (SPCurve *) l->data;
- memcpy(bp, c->bpath, c->end * sizeof(NArtBpath));
+ memcpy(bp, c->_bpath, c->end * sizeof(NArtBpath));
bp += c->end;
}
new_curve->end = length;
gint i;
for (i = new_curve->end; i > 0; i--) {
- if ((new_curve->bpath[i].code == NR_MOVETO) ||
- (new_curve->bpath[i].code == NR_MOVETO_OPEN) )
+ if ((new_curve->_bpath[i].code == NR_MOVETO) ||
+ (new_curve->_bpath[i].code == NR_MOVETO_OPEN) )
break;
}
while (p < curve->end) {
gint i = 1;
- while ((curve->bpath[p + i].code == NR_LINETO) ||
- (curve->bpath[p + i].code == NR_CURVETO))
+ while ((curve->_bpath[p + i].code == NR_LINETO) ||
+ (curve->_bpath[p + i].code == NR_CURVETO))
i++;
SPCurve *new_curve = sp_curve_new_sized(i + 1);
- memcpy(new_curve->bpath, curve->bpath + p, i * sizeof(NArtBpath));
+ memcpy(new_curve->_bpath, curve->_bpath + p, i * sizeof(NArtBpath));
new_curve->end = i;
- new_curve->bpath[i].code = NR_END;
+ new_curve->_bpath[i].code = NR_END;
new_curve->substart = 0;
- new_curve->closed = (new_curve->bpath->code == NR_MOVETO);
- new_curve->hascpt = (new_curve->bpath->code == NR_MOVETO_OPEN);
+ new_curve->closed = (new_curve->_bpath->code == NR_MOVETO);
+ new_curve->hascpt = (new_curve->_bpath->code == NR_MOVETO_OPEN);
l = g_slist_append(l, new_curve);
/** \todo
* effic: Use g_slist_prepend instead. Either work backwards from
g_return_if_fail(!curve->sbpath);
for (gint i = 0; i < curve->end; i++) {
- NArtBpath *p = curve->bpath + i;
+ NArtBpath *p = curve->_bpath + i;
switch (p->code) {
case NR_MOVETO:
case NR_MOVETO_OPEN:
g_return_if_fail(curve != NULL);
g_return_if_fail(!curve->sbpath);
- curve->bpath->code = NR_END;
+ curve->_bpath->code = NR_END;
curve->end = 0;
curve->substart = 0;
curve->hascpt = false;
/* fix endpoint */
g_return_if_fail(!curve->posSet);
g_return_if_fail(curve->end > 1);
- NArtBpath *bp = curve->bpath + curve->end - 1;
+ NArtBpath *bp = curve->_bpath + curve->end - 1;
g_return_if_fail(bp->code == NR_LINETO);
bp->x3 = x;
bp->y3 = y;
if (curve->posSet) {
/* start a new segment */
sp_curve_ensure_space(curve, 2);
- NArtBpath *bp = curve->bpath + curve->end;
+ NArtBpath *bp = curve->_bpath + curve->end;
bp->code = NR_MOVETO_OPEN;
bp->setC(3, curve->movePos);
bp++;
g_return_if_fail(curve->end > 1);
sp_curve_ensure_space(curve, 1);
- NArtBpath *bp = curve->bpath + curve->end;
+ NArtBpath *bp = curve->_bpath + curve->end;
bp->code = NR_LINETO;
bp->x3 = x;
bp->y3 = y;
/* change endpoint */
g_return_if_fail(!curve->posSet);
g_return_if_fail(curve->end > 1);
- NArtBpath *bp = curve->bpath + curve->end - 1;
+ NArtBpath *bp = curve->_bpath + curve->end - 1;
g_return_if_fail(bp->code == NR_LINETO);
bp->x3 = x;
bp->y3 = y;
if (curve->posSet) {
/* start a new segment */
sp_curve_ensure_space(curve, 2);
- NArtBpath *bp = curve->bpath + curve->end;
+ NArtBpath *bp = curve->_bpath + curve->end;
bp->code = NR_MOVETO_OPEN;
bp->setC(3, curve->movePos);
bp++;
g_return_if_fail(curve->end > 1);
sp_curve_ensure_space(curve, 1);
- NArtBpath *bp = curve->bpath + curve->end;
+ NArtBpath *bp = curve->_bpath + curve->end;
bp->code = NR_LINETO;
bp->x3 = x;
bp->y3 = y;
@@ -561,7 +561,7 @@ sp_curve_curveto(SPCurve *curve, gdouble x0, gdouble y0, gdouble x1, gdouble y1,
if (curve->posSet) {
/* start a new segment */
sp_curve_ensure_space(curve, 2);
- NArtBpath *bp = curve->bpath + curve->end;
+ NArtBpath *bp = curve->_bpath + curve->end;
bp->code = NR_MOVETO_OPEN;
bp->setC(3, curve->movePos);
bp++;
@@ -584,7 +584,7 @@ sp_curve_curveto(SPCurve *curve, gdouble x0, gdouble y0, gdouble x1, gdouble y1,
g_return_if_fail(curve->end > 1);
sp_curve_ensure_space(curve, 1);
- NArtBpath *bp = curve->bpath + curve->end;
+ NArtBpath *bp = curve->_bpath + curve->end;
bp->code = NR_CURVETO;
bp->x1 = x0;
bp->y1 = y0;
g_return_if_fail(curve->end - curve->substart > 1);
{
- NArtBpath *bs = curve->bpath + curve->substart;
- NArtBpath *be = curve->bpath + curve->end - 1;
+ NArtBpath *bs = curve->_bpath + curve->substart;
+ NArtBpath *be = curve->_bpath + curve->end - 1;
if (bs->c(3) != be->c(3)) {
sp_curve_lineto(curve, bs->c(3));
- bs = curve->bpath + curve->substart;
+ bs = curve->_bpath + curve->substart;
}
bs->code = NR_MOVETO;
}
curve->closed = true;
- for (NArtBpath const *bp = curve->bpath; bp->code != NR_END; bp++) {
+ for (NArtBpath const *bp = curve->_bpath; bp->code != NR_END; bp++) {
/** \todo
* effic: Maintain a count of NR_MOVETO_OPEN's (e.g. instead of
* the closed boolean).
g_return_if_fail(curve->end - curve->substart > 1);
{
- NArtBpath *bs = curve->bpath + curve->substart;
- NArtBpath *be = curve->bpath + curve->end - 1;
+ NArtBpath *bs = curve->_bpath + curve->substart;
+ NArtBpath *be = curve->_bpath + curve->end - 1;
be->x3 = bs->x3;
be->y3 = bs->y3;
}
curve->closed = true;
- for (NArtBpath const *bp = curve->bpath; bp->code != NR_END; bp++) {
+ for (NArtBpath const *bp = curve->_bpath; bp->code != NR_END; bp++) {
/** \todo
* effic: Maintain a count of NR_MOVETO_OPEN's (e.g. instead of
* the closed boolean).
{
g_return_val_if_fail(curve != NULL, TRUE);
- return (curve->bpath->code == NR_END);
+ return (curve->_bpath->code == NR_END);
}
/**
return NULL;
}
- return curve->bpath + curve->end - 1;
+ return curve->_bpath + curve->end - 1;
}
/**
return NULL;
}
- return curve->bpath;
+ return curve->_bpath;
}
/**
NArtBpath *bpath = NULL;
if (curve->end < 2) {
- bpath = curve->bpath;
+ bpath = curve->_bpath;
} else {
- bpath = curve->bpath + 1;
+ bpath = curve->_bpath + 1;
}
g_return_val_if_fail(bpath != NULL, NR::Point(0, 0));
return bpath->c(3);
return curve->movePos;
}
- NArtBpath *const bpath = curve->bpath + curve->end - 2;
+ NArtBpath *const bpath = curve->_bpath + curve->end - 2;
g_return_val_if_fail(bpath != NULL, NR::Point(0, 0));
return bpath->c(3);
}
/* We need at least moveto, curveto, end. */
g_return_val_if_fail(curve->end - curve->substart > 1, NULL);
- NArtBpath const *be = curve->bpath + curve->end - 1;
+ NArtBpath const *be = curve->_bpath + curve->end - 1;
- g_assert(is_moveto(curve->bpath[curve->substart].code));
- g_assert(is_moveto(curve->bpath[0].code));
+ g_assert(is_moveto(curve->_bpath[curve->substart].code));
+ g_assert(is_moveto(curve->_bpath[0].code));
g_assert((be+1)->code == NR_END);
SPCurve *new_curve = sp_curve_new_sized(curve->length);
for (NArtBpath const *bp = be; ; --bp) {
switch (bp->code) {
case NR_MOVETO:
- g_assert(new_curve->bpath[new_curve->substart].code == NR_MOVETO_OPEN);
- new_curve->bpath[new_curve->substart].code = NR_MOVETO;
+ g_assert(new_curve->_bpath[new_curve->substart].code == NR_MOVETO_OPEN);
+ new_curve->_bpath[new_curve->substart].code = NR_MOVETO;
/* FALL-THROUGH */
case NR_MOVETO_OPEN:
- if (bp == curve->bpath) {
+ if (bp == curve->_bpath) {
return new_curve;
}
sp_curve_moveto(new_curve, (bp-1)->c(3));
if (curve2->end < 1)
return;
- NArtBpath const *bs = curve2->bpath;
+ NArtBpath const *bs = curve2->_bpath;
bool closed = curve->closed;
if (curve->end > 0) {
curve->end -= 1;
if (curve->end > 0) {
- NArtBpath *bp = curve->bpath + curve->end - 1;
+ NArtBpath *bp = curve->_bpath + curve->end - 1;
if ((bp->code == NR_MOVETO) ||
(bp->code == NR_MOVETO_OPEN) )
{
curve->end -= 1;
}
}
- curve->bpath[curve->end].code = NR_END;
+ curve->_bpath[curve->end].code = NR_END;
}
}
@@ -1170,13 +1170,13 @@ sp_curve_distance_including_space(SPCurve const *const curve, double seg2len[])
double ret = 0.0;
- if ( curve->bpath->code == NR_END ) {
+ if ( curve->_bpath->code == NR_END ) {
return ret;
}
- NR::Point prev(curve->bpath->c(3));
+ NR::Point prev(curve->_bpath->c(3));
for (gint i = 1; i < curve->end; ++i) {
- NArtBpath &p = curve->bpath[i];
+ NArtBpath &p = curve->_bpath[i];
double seg_len = 0;
switch (p.code) {
case NR_MOVETO_OPEN:
@@ -1225,18 +1225,18 @@ sp_curve_stretch_endpoints(SPCurve *curve, NR::Point const &new_p0, NR::Point co
if (sp_curve_empty(curve)) {
return;
}
- g_assert(unsigned(SP_CURVE_LENGTH(curve)) + 1 == sp_bpath_length(curve->bpath));
+ g_assert(unsigned(SP_CURVE_LENGTH(curve)) + 1 == sp_bpath_length(curve->_bpath));
unsigned const nSegs = SP_CURVE_LENGTH(curve) - 1;
g_assert(nSegs != 0);
double *const seg2len = new double[nSegs];
double const tot_len = sp_curve_nonzero_distance_including_space(curve, seg2len);
NR::Point const offset0( new_p0 - sp_curve_first_point(curve) );
NR::Point const offset1( new_p1 - sp_curve_last_point(curve) );
- curve->bpath->setC(3, new_p0);
+ curve->_bpath->setC(3, new_p0);
double begin_dist = 0.;
for (unsigned si = 0; si < nSegs; ++si) {
double const end_dist = begin_dist + seg2len[si];
- NArtBpath &p = curve->bpath[1 + si];
+ NArtBpath &p = curve->_bpath[1 + si];
switch (p.code) {
case NR_LINETO:
case NR_MOVETO:
@@ -1256,9 +1256,9 @@ sp_curve_stretch_endpoints(SPCurve *curve, NR::Point const &new_p0, NR::Point co
begin_dist = end_dist;
}
- g_assert(L1(curve->bpath[nSegs].c(3) - new_p1) < 1.);
+ g_assert(L1(curve->_bpath[nSegs].c(3) - new_p1) < 1.);
/* Explicit set for better numerical properties. */
- curve->bpath[nSegs].setC(3, new_p1);
+ curve->_bpath[nSegs].setC(3, new_p1);
delete [] seg2len;
}
unsigned const nSegs = SP_CURVE_LENGTH(curve) - 1;
g_assert(nSegs != 0);
- curve->bpath->setC(3, new_p0);
- curve->bpath[nSegs].setC(3, new_p1);
+ curve->_bpath->setC(3, new_p0);
+ curve->_bpath[nSegs].setC(3, new_p1);
}
diff --git a/src/display/curve.h b/src/display/curve.h
index d637961405273c84737979a45478578dccb1cef7..07d951b6330022ddccfd3ee732fdfbe3d7db4fbe 100644 (file)
--- a/src/display/curve.h
+++ b/src/display/curve.h
/// Wrapper around NArtBpath.
struct SPCurve {
gint refcount;
- NArtBpath *bpath;
+ NArtBpath *_bpath;
/// Index in bpath[] of NR_END element.
gint end;
};
#define SP_CURVE_LENGTH(c) (((SPCurve const *)(c))->end)
-#define SP_CURVE_BPATH(c) (((SPCurve const *)(c))->bpath)
-#define SP_CURVE_SEGMENT(c,i) (((SPCurve const *)(c))->bpath + (i))
+#define SP_CURVE_BPATH(c) (((SPCurve const *)(c))->_bpath)
+#define SP_CURVE_SEGMENT(c,i) (((SPCurve const *)(c))->_bpath + (i))
/* Constructors */
index e1e0ea54023b245f156350c85eb1bf2230ef536c..8d5a48be8e45ed8dd39b153d08d224d892c34bc2 100644 (file)
@@ -214,7 +214,7 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g
/* fixme: */
bbox.x0 = bbox.y0 = NR_HUGE;
bbox.x1 = bbox.y1 = -NR_HUGE;
- bp.path = shape->curve->bpath;
+ bp.path = SP_CURVE_BPATH(shape->curve);
nr_path_matrix_bbox_union(&bp, gc->transform, &bbox);
item->bbox.x0 = (gint32)(bbox.x0 - 1.0F);
item->bbox.y0 = (gint32)(bbox.y0 - 1.0F);
@@ -240,7 +240,7 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g
/* fixme: */
bbox.x0 = bbox.y0 = NR_HUGE;
bbox.x1 = bbox.y1 = -NR_HUGE;
- bp.path = shape->curve->bpath;
+ bp.path = SP_CURVE_BPATH(shape->curve);
nr_path_matrix_bbox_union(&bp, gc->transform, &bbox);
if (shape->_stroke.paint.type() != NRArenaShape::Paint::NONE) {
float width, scale;
nr_arena_shape_update_fill(NRArenaShape *shape, NRGC *gc, NRRectL *area, bool force_shape)
{
if ((shape->_fill.paint.type() != NRArenaShape::Paint::NONE || force_shape) &&
- ((shape->curve->end > 2) || (shape->curve->bpath[1].code == NR_CURVETO)) ) {
+ ((shape->curve->end > 2) || (SP_CURVE_BPATH(shape->curve)[1].code == NR_CURVETO)) ) {
if (TRUE || !shape->fill_shp) {
NR::Matrix cached_to_new;
int isometry = 0;
@@ -410,7 +410,7 @@ nr_arena_shape_update_fill(NRArenaShape *shape, NRGC *gc, NRRectL *area, bool fo
Shape* theShape=new Shape;
{
NR::Matrix tempMat(gc->transform);
- thePath->LoadArtBPath(shape->curve->bpath,tempMat,true);
+ thePath->LoadArtBPath(SP_CURVE_BPATH(shape->curve),tempMat,true);
}
if (is_inner_area(*area, NR_ARENA_ITEM(shape)->bbox)) {
Shape* theShape = new Shape;
{
NR::Matrix tempMat(gc->transform);
- thePath->LoadArtBPath(shape->curve->bpath, tempMat, true);
+ thePath->LoadArtBPath(SP_CURVE_BPATH(shape->curve), tempMat, true);
}
// add some padding to the rendering area, so clipped path does not go into a render area
@@ -888,7 +888,7 @@ nr_arena_shape_pick(NRArenaItem *item, NR::Point p, double delta, unsigned int /
}
} else {
NRBPath bp;
- bp.path = shape->curve->bpath;
+ bp.path = SP_CURVE_BPATH(shape->curve);
double dist = NR_HUGE;
int wind = 0;
nr_path_matrix_point_bbox_wind_distance(&bp, shape->ctm, p, NULL, &wind, &dist, NR_EPSILON);
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index 75ded20f5a04a388aab181a92d8d9f56fdf49f7a..6263880a4ded0f79151a13b94dc0a826e48c8bac 100644 (file)
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
SPCurve *c;
c = (SPCurve*)l->data;
g_return_if_fail( c->end > 1 );
- if ( c->bpath->code == NR_MOVETO_OPEN ) {
+ if ( SP_CURVE_BPATH(c)->code == NR_MOVETO_OPEN ) {
NArtBpath *s, *e;
SPDrawAnchor *a;
s = sp_curve_first_bpath(c);
index 11cf842d36931d9f06389d05b1aecabe2a0acecd..16ff0f18f2469e3d7a01ecf1a0966d241b0373ea 100644 (file)
bbox_width * 1000.0, bbox_height * 1000.0);
outs.printf(" svg:d=\"");
- writePath(outs, curve->bpath, tf, bbox_x, bbox_y);
+ writePath(outs, SP_CURVE_BPATH(curve), tf, bbox_x, bbox_y);
outs.printf("\"");
outs.printf(">\n");
index fbe64bd8188c0fe111085a058a2517f0419f5d4d..8450b104088eaf234ef7e4e37d8b7cf58fe56a22 100644 (file)
@@ -217,12 +217,12 @@ PovOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *
//Count the NR_CURVETOs/LINETOs
int segmentCount=0;
- NArtBpath *bp = curve->bpath;
+ NArtBpath *bp = SP_CURVE_BPATH(curve);
for (curveNr=0 ; curveNr<curve->length ; curveNr++, bp++)
if (bp->code == NR_CURVETO || bp->code == NR_LINETO)
segmentCount++;
- bp = curve->bpath;
+ bp = SP_CURVE_BPATH(curve);
double cminx = bignum;
double cmaxx = -bignum;
double cminy = bignum;
@@ -240,7 +240,7 @@ PovOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *
fprintf(f, " 0.0, //bottom\n");
fprintf(f, " %d, //nr points\n", segmentCount * 4);
int segmentNr = 0;
- for (bp = curve->bpath, curveNr=0 ; curveNr<curve->length ; curveNr++, bp++) {
+ for (bp = SP_CURVE_BPATH(curve), curveNr=0 ; curveNr<curve->length ; curveNr++, bp++) {
using NR::X;
using NR::Y;
NR::Point const p1(bp->c(1) * tf);
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index e81abdacbd4e73bff87c71e7f28834df7880d282..18da75111528243c781163382aa9bcdc0a31bcdd 100644 (file)
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
SPCurve *curve = create_curve(np);
gchar *typestr = create_typestr(np);
- gchar *svgpath = sp_svg_write_path(curve->bpath);
+ gchar *svgpath = sp_svg_write_path(SP_CURVE_BPATH(curve));
if (repr->attribute("d") == NULL || strcmp(svgpath, repr->attribute("d"))) { // d changed
np->local_change++;
SPCurve *curve = create_curve(np);
gchar *typestr = create_typestr(np);
- gchar *svgpath = sp_svg_write_path(curve->bpath);
+ gchar *svgpath = sp_svg_write_path(SP_CURVE_BPATH(curve));
new_repr->setAttribute("d", svgpath);
new_repr->setAttribute("sodipodi:nodetypes", typestr);
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index e7a975d01397f8066cb2921f0b302be11ab53dd6..9439fea8b0d854e526c7ccbc2763b456ee17ae14 100644 (file)
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
int j = 0;
NR::Matrix const i2doc = sp_item_i2doc_affine(*i);
- while (sh->curve->bpath[j].code != NR_END) {
+ while (SP_CURVE_BPATH(sh->curve)[j].code != NR_END) {
/* Get this node in desktop coordinates */
- NArtBpath const &bp = sh->curve->bpath[j];
+ NArtBpath const &bp = SP_CURVE_BPATH(sh->curve)[j];
NR::Point const n = desktop->doc2dt(bp.c(3) * i2doc);
/* Try to snap to this node of the path */
diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp
index de775ac1935ede4c7a1da4e4733e52901bdf77ae..1cd7480aa6692a5fd459f3997cec650d9a69a0eb 100644 (file)
--- a/src/path-chemistry.cpp
+++ b/src/path-chemistry.cpp
SPPath *path = (SPPath *) i->data;
SPCurve *c = sp_shape_get_curve(SP_SHAPE(path));
- NArtBpath *abp = nr_artpath_affine(c->bpath, SP_ITEM(path)->transform);
+ NArtBpath *abp = nr_artpath_affine(SP_CURVE_BPATH(c), SP_ITEM(path)->transform);
sp_curve_unref(c);
gchar *str = sp_svg_write_path(abp);
nr_free(abp);
gchar *style = g_strdup(SP_OBJECT(item)->repr->attribute("style"));
- NArtBpath *abp = nr_artpath_affine(curve->bpath, (SP_ITEM(path))->transform);
+ NArtBpath *abp = nr_artpath_affine(SP_CURVE_BPATH(curve), (SP_ITEM(path))->transform);
sp_curve_unref(curve);
Inkscape::XML::Node *repr = sp_repr_new("svg:path");
repr->setAttribute("style", style);
- gchar *str = sp_svg_write_path(curve->bpath);
+ gchar *str = sp_svg_write_path(SP_CURVE_BPATH(curve));
repr->setAttribute("d", str);
g_free(str);
sp_repr_set_attr(repr, "inkscape:transform-center-y", SP_OBJECT_REPR(item)->attribute("inkscape:transform-center-y"));
/* Definition */
- gchar *def_str = sp_svg_write_path(curve->bpath);
+ gchar *def_str = sp_svg_write_path(SP_CURVE_BPATH(curve));
repr->setAttribute("d", def_str);
g_free(def_str);
sp_curve_unref(curve);
SPCurve *rcurve = sp_curve_reverse(shape->curve);
- gchar *str = sp_svg_write_path(rcurve->bpath);
+ gchar *str = sp_svg_write_path(SP_CURVE_BPATH(rcurve));
SP_OBJECT_REPR(shape)->setAttribute("d", str);
g_free(str);
diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp
index 95695768e8f5025c9738696006c79347db1e5e0d..51bc4c511be61d872c5966115971feb75669c883 100644 (file)
--- a/src/sp-flowregion.cpp
+++ b/src/sp-flowregion.cpp
Path* temp=new Path;
NR::Matrix tr_mat=sp_item_i2root_affine (SP_ITEM(u_child));
tr_mat=itr_mat*tr_mat;
- temp->LoadArtBPath(curve->bpath,tr_mat,true);
+ temp->LoadArtBPath(SP_CURVE_BPATH(curve),tr_mat,true);
Shape* n_shp=new Shape;
temp->Convert(0.25);
temp->Fill(n_shp,0);
diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp
index fc9115f24adadbacc7f3af3c1475df4cc962beb4..6aead7a548d0775414c1474adffdf26bcbe8bccd 100644 (file)
--- a/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
}
// write that curve to "d"
- char *d = sp_svg_write_path (((SPShape *) offset)->curve->bpath);
+ char *d = sp_svg_write_path (SP_CURVE_BPATH(((SPShape *) offset)->curve));
repr->setAttribute("d", d);
g_free (d);
bpath = sp_svg_read_path (offset->original);
curve = sp_curve_new_from_bpath (bpath); // curve se chargera de detruire bpath
g_assert (curve != NULL);
- offset->originalPath = bpath_to_liv_path (curve->bpath);
+ offset->originalPath = bpath_to_liv_path (SP_CURVE_BPATH(curve));
sp_curve_unref (curve);
offset->knotSet = false;
return;
}
- Path *finalPath = bpath_to_liv_path (curve->bpath);
+ Path *finalPath = bpath_to_liv_path (SP_CURVE_BPATH(curve));
if (finalPath == NULL)
{
sp_curve_unref (curve);
if (curve == NULL)
return;
}
- orig = bpath_to_liv_path (curve->bpath);
+ orig = bpath_to_liv_path (SP_CURVE_BPATH(curve));
sp_curve_unref (curve);
diff --git a/src/sp-path.cpp b/src/sp-path.cpp
index 9fe2f54c56a216b440a98a4ab55caaa88e7a925a..ee98cc15095c146dbe6a11026ce3c18b3694312e 100644 (file)
--- a/src/sp-path.cpp
+++ b/src/sp-path.cpp
gint i = curve->length - 1;
if (i > r) i = r; // sometimes after switching from node editor length is wrong, e.g. f6 - draw - f2 - tab - f1, this fixes it
for (; i >= 0; i --)
- if ((curve->bpath + i) -> code == NR_MOVETO)
+ if (SP_CURVE_BPATH(curve)[i].code == NR_MOVETO)
r --;
return r;
}
/* Transform the path */
NRBPath dpath, spath;
- spath.path = shape->curve->bpath;
+ spath.path = SP_CURVE_BPATH(shape->curve);
nr_path_duplicate_transform(&dpath, &spath, xform);
SPCurve *curve = sp_curve_new_from_bpath(dpath.path);
if (curve) {
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index 7366e533f1832de2b85defe6c3251f0488583a65..1723390950f925cf4b95335f329bd8ac905706ee 100644 (file)
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
return false;
}
- if (bp == shape->curve->bpath)
+ if (bp == SP_CURVE_BPATH(shape->curve))
return m == SP_MARKER_LOC_START;
else if (bp[1].code == NR_END)
return m == SP_MARKER_LOC_END;
static NR::Matrix
sp_shape_marker_get_transform(SPShape const *shape, NArtBpath const *bp)
{
- g_return_val_if_fail(( is_moveto(shape->curve->bpath[0].code)
+ g_return_val_if_fail(( is_moveto(SP_CURVE_BPATH(shape->curve)[0].code)
&& ( 0 < shape->curve->end )
- && ( shape->curve->bpath[shape->curve->end].code == NR_END ) ),
+ && ( SP_CURVE_BPATH(shape->curve)[shape->curve->end].code == NR_END ) ),
NR::Matrix(NR::translate(bp->c(3))));
double const angle1 = incoming_tangent(bp);
double const angle2 = outgoing_tangent(bp);
int n = 0;
- for (NArtBpath *bp = shape->curve->bpath; bp->code != NR_END; bp++) {
+ for (NArtBpath *bp = SP_CURVE_BPATH(shape->curve); bp->code != NR_END; bp++) {
if (sp_shape_marker_required (shape, i, bp)) {
NR::Matrix const m(sp_shape_marker_get_transform(shape, bp));
sp_marker_show_instance ((SPMarker* ) shape->marker[i], ai,
@@ -552,7 +552,7 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &tr
// Union with bboxes of the markers, if any
if (sp_shape_has_markers (shape)) {
- for (NArtBpath* bp = shape->curve->bpath; bp->code != NR_END; bp++) {
+ for (NArtBpath* 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)) {
if (style->fill.type != SP_PAINT_TYPE_NONE) {
NRBPath bp;
- bp.path = shape->curve->bpath;
+ bp.path = SP_CURVE_BPATH(shape->curve);
sp_print_fill (ctx, &bp, i2d, style, &pbox, &dbox, &bbox);
}
if (style->stroke.type != SP_PAINT_TYPE_NONE) {
NRBPath bp;
- bp.path = shape->curve->bpath;
+ bp.path = SP_CURVE_BPATH(shape->curve);
sp_print_stroke (ctx, &bp, i2d, style, &pbox, &dbox, &bbox);
}
- for (NArtBpath* bp = shape->curve->bpath; bp->code != NR_END; bp++) {
+ for (NArtBpath* 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)) {
sp_shape_number_of_markers (SPShape *shape, int type)
{
int n = 0;
- for (NArtBpath* bp = shape->curve->bpath; bp->code != NR_END; bp++) {
+ for (NArtBpath* bp = SP_CURVE_BPATH(shape->curve); bp->code != NR_END; bp++) {
if (sp_shape_marker_required (shape, type, bp)) {
n++;
}
NR::Matrix const i2d (sp_item_i2d_affine (item));
/* Use the end points of each segment of the path */
- NArtBpath const *bp = shape->curve->bpath;
+ NArtBpath const *bp = SP_CURVE_BPATH(shape->curve);
while (bp->code != NR_END) {
*p = bp->c(3) * i2d;
bp++;
diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp
index 9c04120e1e8dea67091c679d1e7185a93cba5697..ab65ba4ddd65484920199888d7480031784bcf86 100644 (file)
--- a/src/sp-spiral.cpp
+++ b/src/sp-spiral.cpp
//g_warning("sp_spiral_write(): No path to copy\n");
return NULL;
}
- NArtBpath *bpath = curve->bpath;
+ NArtBpath *bpath = SP_CURVE_BPATH(curve);
if ( !bpath ) {
//g_warning("sp_spiral_write(): No path to copy\n");
return NULL;
diff --git a/src/sp-star.cpp b/src/sp-star.cpp
index eea11791ff291279c9c30ddfd1db782f34dacfc7..04efd8e93b425a8ad61624c798bf8651d94b24fa 100644 (file)
--- a/src/sp-star.cpp
+++ b/src/sp-star.cpp
}
sp_star_set_shape ((SPShape *) star);
- char *d = sp_svg_write_path (((SPShape *) star)->curve->bpath);
+ char *d = sp_svg_write_path (SP_CURVE_BPATH(((SPShape *) star)->curve));
repr->setAttribute("d", d);
g_free (d);
index c6619dbf5f70d30b0104418432511a1c1f4e9564..9e304799876e359a48449e9f8ef7687c2a911953 100644 (file)
--- a/src/sp-use-reference.cpp
+++ b/src/sp-use-reference.cpp
}
}
originalPath = new Path;
- originalPath->LoadArtBPath(curve->bpath, NR::Matrix(item->transform), true);
+ originalPath->LoadArtBPath(SP_CURVE_BPATH(curve), NR::Matrix(item->transform), true);
sp_curve_unref(curve);
}
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index c5969576e6d348d23658d35a1130b1d4e690a889..eeb82970b6bc8a7cae962a584fd896e97e631e56 100644 (file)
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
if (!curve)
return NULL;
- NArtBpath *bpath = curve->bpath;
+ NArtBpath *bpath = SP_CURVE_BPATH(curve);
if (bpath == NULL)
return NULL;
if ( doTransformation ) {
if (transformFull)
- bpath = nr_artpath_affine(curve->bpath, sp_item_i2doc_affine(item));
+ bpath = nr_artpath_affine(SP_CURVE_BPATH(curve), sp_item_i2doc_affine(item));
else
- bpath = nr_artpath_affine(curve->bpath, item->transform);
+ bpath = nr_artpath_affine(SP_CURVE_BPATH(curve), item->transform);
sp_curve_unref(curve);
curve=NULL;
} else {
- bpath=curve->bpath;
+ bpath=SP_CURVE_BPATH(curve);
}
Path *dest = new Path;