summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 42fe2f2)
raw | patch | inline | side by side (parent: 42fe2f2)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 9 May 2008 17:06:59 +0000 (17:06 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 9 May 2008 17:06:59 +0000 (17:06 +0000) |
39 files changed:
diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp
index 2fff9f7b5933586e89a05dedd60232e8efc8c9a2..4bd10e854d3c984e0c62f3ca0e6d4e0b16dc55b9 100644 (file)
--- a/src/box3d-side.cpp
+++ b/src/box3d-side.cpp
sp_shape_set_shape ((SPShape *) object);
/* Duplicate the path */
- SPCurve *curve = ((SPShape *) object)->curve;
+ SPCurve const *curve = ((SPShape *) object)->curve;
//Nulls might be possible if this called iteratively
if ( !curve ) {
return NULL;
}
- NArtBpath *bpath = SP_CURVE_BPATH(curve);
+ NArtBpath const *bpath = SP_CURVE_BPATH(curve);
if ( !bpath ) {
return NULL;
}
diff --git a/src/display/curve.cpp b/src/display/curve.cpp
index 5b2ac024b8d39379cd7280b48e3652536cfae620..489553dacf7f40205dcb621d0a900cdd9d28afe6 100644 (file)
--- a/src/display/curve.cpp
+++ b/src/display/curve.cpp
{
return _bpath;
};
+/*
NArtBpath *
SPCurve::get_bpath()
{
return _bpath;
};
+*/
/**
* Increase _refcount of curve.
{
g_return_val_if_fail(this != NULL, NULL);
- gint p = 0;
+ guint p = 0;
GSList *l = NULL;
while (p < _end) {
{
g_return_if_fail(curve != NULL);
- for (gint i = 0; i < curve->_end; i++) {
+ for (guint i = 0; i < curve->_end; i++) {
NArtBpath *p = curve->_bpath + i;
switch (p->code) {
case NR_MOVETO:
diff --git a/src/display/curve.h b/src/display/curve.h
index 28fce31323e030b6c6fe8d2910eb7fd1a161031d..5cd8bb12cadd1b04ca241308b3d890340e049b07 100644 (file)
--- a/src/display/curve.h
+++ b/src/display/curve.h
void set_bpath(NArtBpath * new_bpath);
NArtBpath const * get_bpath() const;
- NArtBpath * get_bpath();
/// Index in bpath[] of NR_END element.
guint _end;
index d2e2b7d8b12b3554d9c7cd4313bc981c969fd616..15660e5877d88b930ee919d345780e0622b00983 100644 (file)
/** Feeds path-creating calls to the cairo context translating them from the SPCurve, with the given transform and shift */
void
-feed_curve_to_cairo (cairo_t *ct, NArtBpath *bpath, NR::Matrix trans, NR::Maybe<NR::Rect> area, bool optimize_stroke, double stroke_width)
+feed_curve_to_cairo (cairo_t *ct, NArtBpath const *bpath, NR::Matrix trans, NR::Maybe<NR::Rect> area, bool optimize_stroke, double stroke_width)
{
NR::Point next(0,0), last(0,0);
if (!area || area->isEmpty())
index fa579fb2072a37de147286b2a8399a60f1070866..55fa08263c123465d876b6c73388d6997cdb28e2 100644 (file)
*/
cairo_t *nr_create_cairo_context (NRRectL *area, NRPixBlock *pb);
-void feed_curve_to_cairo (cairo_t *ct, NArtBpath *bpath, NR::Matrix trans, NR::Maybe<NR::Rect> area, bool optimize_stroke, double stroke_width);
+void feed_curve_to_cairo (cairo_t *ct, NArtBpath const *bpath, NR::Matrix trans, NR::Maybe<NR::Rect> area, bool optimize_stroke, double stroke_width);
#endif
/*
index aba06068e1d8ef2ccc3de1a94c8ddac98209fa68..0ff7132e189d419b11abc94c154a3d2feb4d86bb 100644 (file)
@@ -249,7 +249,7 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g
shape->ctm = gc->transform;
if (state & NR_ARENA_ITEM_STATE_BBOX) {
if (shape->curve) {
- NRBPath bp;
+ const_NRBPath bp;
/* fixme: */
bbox.x0 = bbox.y0 = NR_HUGE;
bbox.x1 = bbox.y1 = -NR_HUGE;
@@ -277,7 +277,7 @@ nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, g
bool outline = (NR_ARENA_ITEM(shape)->arena->rendermode == Inkscape::RENDERMODE_OUTLINE);
if (shape->curve) {
- NRBPath bp;
+ const_NRBPath bp;
/* fixme: */
bbox.x0 = bbox.y0 = NR_HUGE;
bbox.x1 = bbox.y1 = -NR_HUGE;
@@ -1102,7 +1102,7 @@ nr_arena_shape_pick(NRArenaItem *item, NR::Point p, double delta, unsigned int /
width = 0;
}
- NRBPath bp;
+ const_NRBPath bp;
bp.path = SP_CURVE_BPATH(shape->curve);
double dist = NR_HUGE;
int wind = 0;
diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp
index 6614604ff706e8428244deb6e4317009ed7af9d9..83b865cdba7a9e4afde351fae3faf41ffffa9260 100644 (file)
@@ -166,14 +166,14 @@ Implementation::comment(Inkscape::Extension::Print */*module*/, char const */*co
}
unsigned int
-Implementation::fill(Inkscape::Extension::Print */*module*/, NRBPath const */*bpath*/, NR::Matrix const */*ctm*/, SPStyle const */*style*/,
+Implementation::fill(Inkscape::Extension::Print */*module*/, const_NRBPath const */*bpath*/, NR::Matrix const */*ctm*/, SPStyle const */*style*/,
NRRect const */*pbox*/, NRRect const */*dbox*/, NRRect const */*bbox*/)
{
return 0;
}
unsigned int
-Implementation::stroke(Inkscape::Extension::Print */*module*/, NRBPath const */*bpath*/, NR::Matrix const */*transform*/, SPStyle const */*style*/,
+Implementation::stroke(Inkscape::Extension::Print */*module*/, const_NRBPath const */*bpath*/, NR::Matrix const */*transform*/, SPStyle const */*style*/,
NRRect const */*pbox*/, NRRect const */*dbox*/, NRRect const */*bbox*/)
{
return 0;
diff --git a/src/extension/implementation/implementation.h b/src/extension/implementation/implementation.h
index caa4a89bd17b4ab5c5d656869dc6f045c81adca6..29366ddf5b450044c245e35226c876adc8917932 100644 (file)
virtual unsigned release(Inkscape::Extension::Print *module);
virtual unsigned comment(Inkscape::Extension::Print *module, const char * comment);
virtual unsigned fill(Inkscape::Extension::Print *module,
- NRBPath const *bpath,
+ const_NRBPath const *bpath,
NR::Matrix const *ctm,
SPStyle const *style,
NRRect const *pbox,
NRRect const *dbox,
NRRect const *bbox);
virtual unsigned stroke(Inkscape::Extension::Print *module,
- NRBPath const *bpath,
+ const_NRBPath const *bpath,
NR::Matrix const *transform,
SPStyle const *style,
NRRect const *pbox,
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp
index 0722edff5e9e6f8bdfd9f531ebe36ec36513e399..887ffe602dc233416b4a4adb6474a5344f9058ee 100644 (file)
}
bool
-CairoRenderContext::renderPath(NRBPath const *bpath, SPStyle const *style, NRRect const *pbox)
+CairoRenderContext::renderPath(const_NRBPath const *bpath, SPStyle const *style, NRRect const *pbox)
{
g_assert( _is_valid );
diff --git a/src/extension/internal/cairo-render-context.h b/src/extension/internal/cairo-render-context.h
index 948efc438a87dc7516d028867e3892132adaf8d1..642c6d90edeeabc8a2a176ec3f79e42f2027cf5b 100644 (file)
void addClippingRect(double x, double y, double width, double height);
/* Rendering methods */
- bool renderPath(NRBPath const *bpath, SPStyle const *style, NRRect const *pbox);
+ bool renderPath(const_NRBPath const *bpath, SPStyle const *style, NRRect const *pbox);
bool renderImage(unsigned char *px, unsigned int w, unsigned int h, unsigned int rs,
NR::Matrix const *image_transform, SPStyle const *style);
bool renderGlyphtext(PangoFont *font, NR::Matrix const *font_matrix,
index f13e26abb04a1a7c146dfc5132f456f5a51358b3..7ac9b9a2a87ca243f61a87c411004555b3049315 100644 (file)
SPStyle* style = SP_OBJECT_STYLE (item);
CairoRenderer *renderer = ctx->getRenderer();
- NRBPath bp;
+ const_NRBPath bp;
bp.path = SP_CURVE_BPATH(shape->curve);
ctx->renderPath(&bp, style, &pbox);
- for (NArtBpath* bp = SP_CURVE_BPATH(shape->curve); bp->code != NR_END; bp++) {
+ for (NArtBpath const* 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)) {
diff --git a/src/extension/internal/emf-win32-print.cpp b/src/extension/internal/emf-win32-print.cpp
index bb82183fd8700e45601f19ac4de726390dd81751..1616d5d86863b3c8db8cfca36c671ac6f771cdde 100644 (file)
unsigned int
PrintEmfWin32::fill(Inkscape::Extension::Print *mod,
- NRBPath const *bpath, NR::Matrix const *transform, SPStyle const *style,
+ const_NRBPath const *bpath, NR::Matrix const *transform, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
{
if (!hdc) return 0;
unsigned int
PrintEmfWin32::stroke (Inkscape::Extension::Print *mod,
- const NRBPath *bpath, const NR::Matrix *transform, const SPStyle *style,
+ const const_NRBPath *bpath, const NR::Matrix *transform, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox)
{
if (!hdc) return 0;
index fdf0cd490b8ea59eb70f68bc1678c4df713a6729..c0eb58481ba811811c6721c7d4efc9baba9a4a2b 100644 (file)
virtual unsigned int bind(Inkscape::Extension::Print *module, NR::Matrix const *transform, float opacity);
virtual unsigned int release(Inkscape::Extension::Print *module);
virtual unsigned int fill (Inkscape::Extension::Print * module,
- const NRBPath *bpath, const NR::Matrix *ctm, const SPStyle *style,
+ const const_NRBPath *bpath, const NR::Matrix *ctm, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
virtual unsigned int stroke (Inkscape::Extension::Print * module,
- const NRBPath *bpath, const NR::Matrix *transform, const SPStyle *style,
+ const const_NRBPath *bpath, const NR::Matrix *transform, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
virtual unsigned int comment(Inkscape::Extension::Print *module, const char * comment);
virtual unsigned int text(Inkscape::Extension::Print *module, char const *text,
index 0795ddbdb240c606e9ee80cd429a639ffe8037aa..1496b75f652bf9de028a2ae5184be347f4c1026b 100644 (file)
unsigned int
PrintLatex::fill(Inkscape::Extension::Print *mod,
- NRBPath const *bpath, NR::Matrix const *transform, SPStyle const *style,
+ const_NRBPath const *bpath, NR::Matrix const *transform, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
}
unsigned int
-PrintLatex::stroke (Inkscape::Extension::Print *mod, const NRBPath *bpath, const NR::Matrix *transform, const SPStyle *style,
+PrintLatex::stroke (Inkscape::Extension::Print *mod, const const_NRBPath *bpath, const NR::Matrix *transform, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
index c418eaf5bca9db655e5f9d1e0e534ee7de262736..56600023aa0376c1a0fa7af02fb2eb2163a2f108 100644 (file)
virtual unsigned int finish (Inkscape::Extension::Print * module);
/* Rendering methods */
- virtual unsigned int bind(Inkscape::Extension::Print *module, NR::Matrix const *transform, float opacity);
- virtual unsigned int release(Inkscape::Extension::Print *module);
+ virtual unsigned int bind(Inkscape::Extension::Print *module, NR::Matrix const *transform, float opacity);
+ virtual unsigned int release(Inkscape::Extension::Print *module);
- virtual unsigned int fill (Inkscape::Extension::Print * module, const NRBPath *bpath, const NR::Matrix *ctm, const SPStyle *style,
+ virtual unsigned int fill (Inkscape::Extension::Print * module, const const_NRBPath *bpath, const NR::Matrix *ctm, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
- virtual unsigned int stroke (Inkscape::Extension::Print * module, const NRBPath *bpath, const NR::Matrix *transform, const SPStyle *style,
+ virtual unsigned int stroke (Inkscape::Extension::Print * module, const const_NRBPath *bpath, const NR::Matrix *transform, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
virtual unsigned int comment(Inkscape::Extension::Print *module, const char * comment);
bool textToPath (Inkscape::Extension::Print * ext);
index 6669c619a0c9e904e9a59b1b6da2be2f67761fda..92b8d92c4272f58fe500c00b6e07eab989ad9d1b 100644 (file)
}
unsigned int
-PrintCairoPDF::fill(Inkscape::Extension::Print *mod, NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *const style,
+PrintCairoPDF::fill(Inkscape::Extension::Print *mod, const_NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *const style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
@@ -679,7 +679,7 @@ PrintCairoPDF::print_stroke_style(cairo_t *cr, SPStyle const *style, NRRect cons
}
unsigned int
-PrintCairoPDF::stroke(Inkscape::Extension::Print *mod, NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *style,
+PrintCairoPDF::stroke(Inkscape::Extension::Print *mod, const_NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
index 185f86727dc369d58ab8a9febeaec86c4a100863..b37cfe22dc20f81f143b7a2f0869f1f0bc5b4135 100644 (file)
virtual unsigned int bind(Inkscape::Extension::Print *module, NR::Matrix const *transform, float opacity);
virtual unsigned int release(Inkscape::Extension::Print *module);
virtual unsigned int comment(Inkscape::Extension::Print *module, char const *comment);
- virtual unsigned int fill(Inkscape::Extension::Print *module, NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *style,
+ virtual unsigned int fill(Inkscape::Extension::Print *module, const_NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
- virtual unsigned int stroke(Inkscape::Extension::Print *module, NRBPath const *bpath, NR::Matrix const *transform, SPStyle const *style,
+ virtual unsigned int stroke(Inkscape::Extension::Print *module, const_NRBPath const *bpath, NR::Matrix const *transform, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
virtual unsigned int image(Inkscape::Extension::Print *module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs,
NR::Matrix const *transform, SPStyle const *style);
index ab52ac280e851cde6c13e1b490faeb01711a3362..13024344d98c4bab7df8e8a917f8eca74a8253f7 100644 (file)
unsigned int
-PrintPS::fill(Inkscape::Extension::Print *mod, NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *const style,
+PrintPS::fill(Inkscape::Extension::Print *mod, const_NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *const style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
unsigned int
-PrintPS::stroke(Inkscape::Extension::Print *mod, NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *style,
+PrintPS::stroke(Inkscape::Extension::Print *mod, const_NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
{
if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned.
index 1397063daddb89193d1e5aee8ca835892f5870e1..edeaaeac6786fbdc305593b1ad36e9a20a2cf3f1 100644 (file)
virtual unsigned int bind(Inkscape::Extension::Print *module, NR::Matrix const *transform, float opacity);
virtual unsigned int release(Inkscape::Extension::Print *module);
virtual unsigned int comment(Inkscape::Extension::Print *module, char const *comment);
- virtual unsigned int fill(Inkscape::Extension::Print *module, NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *style,
+ virtual unsigned int fill(Inkscape::Extension::Print *module, const_NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
- virtual unsigned int stroke(Inkscape::Extension::Print *module, NRBPath const *bpath, NR::Matrix const *transform, SPStyle const *style,
+ virtual unsigned int stroke(Inkscape::Extension::Print *module, const_NRBPath const *bpath, NR::Matrix const *transform, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
virtual unsigned int image(Inkscape::Extension::Print *module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs,
NR::Matrix const *transform, SPStyle const *style);
index 6eb634f47c005d88026bb12d9f21809de5675c8e..8fd16edf24b582fd31520e62e4772e5dc1fbbdb0 100644 (file)
virtual unsigned int bind (Inkscape::Extension::Print * module, const NR::Matrix *transform, float opacity);
virtual unsigned int release (Inkscape::Extension::Print * module);
virtual unsigned int comment (Inkscape::Extension::Print * module, const char * comment);
- virtual unsigned int fill (Inkscape::Extension::Print * module, const NRBPath *bpath, const NR::Matrix *ctm, const SPStyle *style,
+ virtual unsigned int fill (Inkscape::Extension::Print * module, const const_NRBPath *bpath, const NR::Matrix *ctm, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
- virtual unsigned int stroke (Inkscape::Extension::Print * module, const NRBPath *bpath, const NR::Matrix *transform, const SPStyle *style,
+ virtual unsigned int stroke (Inkscape::Extension::Print * module, const const_NRBPath *bpath, const NR::Matrix *transform, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
virtual unsigned int image (Inkscape::Extension::Print * module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs,
const NR::Matrix *transform, const SPStyle *style);
index 6f8c1afd2219a939a61942b48e7728a5f2ed71c8..eded694a50cf1e2cf8db2abc9e9cbdcf214f1305 100644 (file)
--- a/src/extension/print.cpp
+++ b/src/extension/print.cpp
}
unsigned int
-Print::fill (const NRBPath *bpath, const NR::Matrix *ctm, const SPStyle *style,
+Print::fill (const const_NRBPath *bpath, const NR::Matrix *ctm, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox)
{
return imp->fill (this, bpath, ctm, style, pbox, dbox, bbox);
}
unsigned int
-Print::stroke (const NRBPath *bpath, const NR::Matrix *transform, const SPStyle *style,
+Print::stroke (const const_NRBPath *bpath, const NR::Matrix *transform, const SPStyle *style,
const NRRect *pbox, const NRRect *dbox, const NRRect *bbox)
{
return imp->stroke (this, bpath, transform, style, pbox, dbox, bbox);
diff --git a/src/extension/print.h b/src/extension/print.h
index 070f928e3724bcb80f79498d9561b30c39e564fa..e9796bb2d6197302d0fa46d7abfcfc7dfcc4dcf6 100644 (file)
--- a/src/extension/print.h
+++ b/src/extension/print.h
float opacity);
unsigned int release (void);
unsigned int comment (const char * comment);
- unsigned int fill (NRBPath const *bpath,
+ unsigned int fill (const_NRBPath const *bpath,
NR::Matrix const *ctm,
SPStyle const *style,
NRRect const *pbox,
NRRect const *dbox,
NRRect const *bbox);
- unsigned int stroke (NRBPath const *bpath,
+ unsigned int stroke (const_NRBPath const *bpath,
NR::Matrix const *transform,
SPStyle const *style,
NRRect const *pbox,
diff --git a/src/libnr/nr-forward.h b/src/libnr/nr-forward.h
index b12d141df78528fdfd152e0d540c57bf796f7eef..112313b24e39b47e17f0138c26f70fe64dc69888 100644 (file)
--- a/src/libnr/nr-forward.h
+++ b/src/libnr/nr-forward.h
class NArtBpath;
struct NRBPath;
+struct const_NRBPath;
struct NRPixBlock;
struct NRRect;
struct NRRectL;
diff --git a/src/libnr/nr-path.cpp b/src/libnr/nr-path.cpp
index 713cfe43dabc69981509d19951121cb9fcfd2f2c..734f3426d639f7d5287be015f4a3286c6c9d421d 100644 (file)
--- a/src/libnr/nr-path.cpp
+++ b/src/libnr/nr-path.cpp
NR::Point const p011, NR::Point const p111,
NRRect *bbox);
-NRBPath *nr_path_duplicate_transform(NRBPath *d, NRBPath *s, NR::Matrix const *transform)
+NRBPath *nr_path_duplicate_transform(NRBPath *d, const_NRBPath *s, NR::Matrix const *transform)
{
int i;
@@ -49,16 +49,17 @@ NRBPath *nr_path_duplicate_transform(NRBPath *d, NRBPath *s, NR::Matrix const *t
return d;
}
-NRBPath *nr_path_duplicate_transform(NRBPath *d, NRBPath *s, NR::Matrix const transform) {
+NRBPath *nr_path_duplicate_transform(NRBPath *d, const_NRBPath *s, NR::Matrix const transform) {
NR::Matrix tr = transform;
return nr_path_duplicate_transform(d, s, &tr);
}
-NArtBpath* nr_artpath_affine(NArtBpath *s, NR::Matrix const &aff) {
- NRBPath bp, abp;
- bp.path = s;
- nr_path_duplicate_transform(&abp, &bp, aff);
- return abp.path;
+NArtBpath* nr_artpath_affine(NArtBpath const *s, NR::Matrix const &aff) {
+ const_NRBPath bp;
+ bp.path = s;
+ NRBPath abp;
+ nr_path_duplicate_transform(&abp, &bp, aff);
+ return abp.path;
}
static void
}
void
-nr_path_matrix_point_bbox_wind_distance (NRBPath *bpath, NR::Matrix const &m, NR::Point &pt,
+nr_path_matrix_point_bbox_wind_distance (const_NRBPath const *bpath, NR::Matrix const &m, NR::Point &pt,
NRRect *bbox, int *wind, NR::Coord *dist,
NR::Coord tolerance, NR::Rect *viewbox)
{
@@ -449,7 +450,7 @@ nr_curve_bbox (NR::Coord x000, NR::Coord y000, NR::Coord x001, NR::Coord y001, N
}
void
-nr_path_matrix_bbox_union(NRBPath const *bpath, NR::Matrix const &m,
+nr_path_matrix_bbox_union(const_NRBPath *bpath, NR::Matrix const &m,
NRRect *bbox)
{
using NR::X;
diff --git a/src/libnr/nr-path.h b/src/libnr/nr-path.h
index bf7369be4290883a44ba81467816b86c50153de4..5e8b0e48e40e9a15daf176643d6548718ea64a91 100644 (file)
--- a/src/libnr/nr-path.h
+++ b/src/libnr/nr-path.h
#include <libnr/nr-forward.h>
#include <libnr/nr-coord.h>
-NArtBpath* nr_artpath_affine(NArtBpath *s, NR::Matrix const &transform);
+NArtBpath* nr_artpath_affine(NArtBpath const *s, NR::Matrix const &transform);
+struct const_NRBPath {
+ NArtBpath const *path;
+};
struct NRBPath {
- NArtBpath *path;
+ NArtBpath *path;
+ operator const_NRBPath() { const_NRBPath bp = { path }; return bp; };
};
-NRBPath *nr_path_duplicate_transform(NRBPath *d, NRBPath *s, NR::Matrix const *transform);
-NRBPath *nr_path_duplicate_transform(NRBPath *d, NRBPath *s, NR::Matrix const transform);
+NRBPath *nr_path_duplicate_transform(NRBPath *d, const_NRBPath *s, NR::Matrix const *transform);
+
+NRBPath *nr_path_duplicate_transform(NRBPath *d, const_NRBPath *s, NR::Matrix const transform);
-void nr_path_matrix_point_bbox_wind_distance (NRBPath *bpath, NR::Matrix const &m, NR::Point &pt,
+void nr_path_matrix_point_bbox_wind_distance (const_NRBPath const *bpath, NR::Matrix const &m, NR::Point &pt,
NRRect *bbox, int *wind, NR::Coord *dist,
NR::Coord tolerance, NR::Rect *viewbox);
-void nr_path_matrix_bbox_union(NRBPath const *bpath, NR::Matrix const &m, NRRect *bbox);
+void nr_path_matrix_bbox_union(const_NRBPath *bpath, NR::Matrix const &m, NRRect *bbox);
NArtBpath *nr_path_from_rect(NRRect const &r);
index f3fac4218611fe70df1cc7956eafdadd063cf38a..499a8f7a5e83506f1068ec8e0b1ccfa61829becc 100755 (executable)
NRBPath bpath;
bpath.path = (NArtBpath*)span.font->ArtBPath(_glyphs[glyph_index].glyph);
if (bpath.path) {
- NRBPath abp;
+ const_NRBPath abp;
_getGlyphTransformMatrix(glyph_index, &glyph_matrix);
- abp.path = nr_artpath_affine(bpath.path, glyph_matrix);
+ NArtBpath *temp_bpath = nr_artpath_affine(bpath.path, glyph_matrix);
+ abp.path = temp_bpath;
if (!text_source->style->fill.isNone())
sp_print_fill(ctx, &abp, &ctm, text_source->style, pbox, dbox, bbox);
if (!text_source->style->stroke.isNone())
sp_print_stroke(ctx, &abp, &ctm, text_source->style, pbox, dbox, bbox);
- g_free(abp.path);
+ g_free(temp_bpath);
}
glyph_index++;
} else {
NArtBpath *bpath = (NArtBpath*)span.font->ArtBPath(_glyphs[glyph_index].glyph);
if (bpath) {
NArtBpath *abp = nr_artpath_affine(bpath, glyph_matrix);
- NRBPath bpath;
+ const_NRBPath bpath;
bpath.path = abp;
SPStyle const *style = text_source->style;
ctx->renderPath(&bpath, style, NULL);
diff --git a/src/livarot/Path.h b/src/livarot/Path.h
index 454fb4ca4da44d25ad9258027bdb7da0d93623b6..2568f9ccc4bafa33cd15defa78620dfb084c81ee 100644 (file)
--- a/src/livarot/Path.h
+++ b/src/livarot/Path.h
void DashPolylineFromStyle(SPStyle *style, float scale, float min_len);
//utilitaire pour inkscape
- void LoadArtBPath(void *iP,NR::Matrix const &tr,bool doTransformation);
+ void LoadArtBPath(void const *iP,NR::Matrix const &tr,bool doTransformation);
void* MakeArtBPath();
void Transform(const NR::Matrix &trans);
index ea8a86f3e26ba851fdea42af044ce12b4ccaa53a..dddb7bdf4d8666e2571ee73ee97b71f00e7a9bd9 100644 (file)
return bpath;
}
-void Path::LoadArtBPath(void *iV,NR::Matrix const &trans,bool doTransformation)
+void Path::LoadArtBPath(void const *iV,NR::Matrix const &trans,bool doTransformation)
{
if ( iV == NULL ) return;
- NArtBpath *bpath = (NArtBpath*)iV;
+ NArtBpath const *bpath = (NArtBpath const*)iV;
SetBackData (false);
Reset();
index 6994b684bff29f0b31e345b395645161badd327c..e4a0af741ed002b251679d0c1d1a6525458248c6 100644 (file)
bezctx *bc = new_bezctx_ink(curve);
int len = SP_CURVE_LENGTH(csrc);
spiro_cp *path = g_new (spiro_cp, len + 1);
- NArtBpath *bpath = csrc->get_bpath();
+ NArtBpath const *bpath = csrc->get_bpath();
int ib = 0;
int ip = 0;
bool closed = false;
NR::Point pt(0, 0);
- NArtBpath *first_in_subpath = NULL;
+ NArtBpath const *first_in_subpath = NULL;
while(ib <= len) {
path [ip].x = bpath[ib].x3;
path [ip].y = bpath[ib].y3;
}
} else {
// this point is not last, so makes sense to find a proper type for it
- NArtBpath *next = NULL;
+ NArtBpath const *next = NULL;
if (ib < len && (bpath[ib+1].code == NR_END || bpath[ib+1].code == NR_MOVETO_OPEN || bpath[ib+1].code == NR_MOVETO)) { // end of subpath
if (closed)
next = first_in_subpath;
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index d82b82f0d01645be6ce916da6c4cbf7cd4564064..c3d0f09b41d06b1a4c58534fcd27587dce5ccbca 100644 (file)
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
{
if (np && np->livarot_path == NULL) {
SPCurve *curve = create_curve(np);
- NArtBpath *bpath = SP_CURVE_BPATH(curve);
+ NArtBpath const *bpath = SP_CURVE_BPATH(curve);
np->livarot_path = bpath_to_Path(bpath);
if (np->livarot_path)
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index ffb776dfeb5df57a268de0c4e87ca291dfca1db1..2584d5b49521be475aa5ba6846943d0e67f502b0 100644 (file)
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
@@ -321,9 +321,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Inkscape::Snapper::PointType const &
SPCurve *curve = curve_for_item(root_item);
if (curve) {
NArtBpath *bpath = bpath_for_curve(root_item, curve, true, true);
- _bpaths_to_snap_to->push_back(bpath);
- // Because we set doTransformation to true in bpath_for_curve, we
- // will get a dupe of the path, which must be freed at some point
+ _bpaths_to_snap_to->push_back(bpath); // we will get a dupe of the path, which must be freed at some point
curve->unref();
}
}
SPCurve *curve = curve_for_item(SP_ITEM(selected_path));
if (curve) {
NArtBpath *bpath = bpath_for_curve(SP_ITEM(selected_path), curve, true, true);
- _bpaths_to_snap_to->push_back(bpath);
- // Because we set doTransformation to true in bpath_for_curve, we
- // will get a dupe of the path, which must be freed at some point
+ _bpaths_to_snap_to->push_back(bpath); // we will get a dupe of the path, which must be freed at some point
curve->unref();
}
}
diff --git a/src/print.cpp b/src/print.cpp
index b557298ef7d5e0f282bfa0591a6ebd61de5124c1..b1fc6b3b24fac4cfc2172dbec82d0fe1d415ef63 100644 (file)
--- a/src/print.cpp
+++ b/src/print.cpp
}
unsigned int
-sp_print_fill(SPPrintContext *ctx, NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *style,
+sp_print_fill(SPPrintContext *ctx, const_NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
{
return ctx->module->fill(bpath, ctm, style, pbox, dbox, bbox);
}
unsigned int
-sp_print_stroke(SPPrintContext *ctx, NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *style,
+sp_print_stroke(SPPrintContext *ctx, const_NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox)
{
return ctx->module->stroke(bpath, ctm, style, pbox, dbox, bbox);
diff --git a/src/print.h b/src/print.h
index dd5c1fa7354344f8066803cb38b05caccdaa56cd..ce30b841807ed6d72ea46898a09b65e727b2dbe0 100644 (file)
--- a/src/print.h
+++ b/src/print.h
unsigned int sp_print_bind(SPPrintContext *ctx, NR::Matrix const *transform, float opacity);
unsigned int sp_print_release(SPPrintContext *ctx);
unsigned int sp_print_comment(SPPrintContext *ctx, char const *comment);
-unsigned int sp_print_fill(SPPrintContext *ctx, NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *style,
+unsigned int sp_print_fill(SPPrintContext *ctx, const_NRBPath const *bpath, NR::Matrix const *ctm, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
-unsigned int sp_print_stroke(SPPrintContext *ctx, NRBPath const *bpath, NR::Matrix const *transform, SPStyle const *style,
+unsigned int sp_print_stroke(SPPrintContext *ctx, const_NRBPath const *bpath, NR::Matrix const *transform, SPStyle const *style,
NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
unsigned int sp_print_image_R8G8B8A8_N(SPPrintContext *ctx,
diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp
index d866df068b3021262ad51390d5a06c12e08cb7fa..5ff01814f06ae6a1c7fd2fc09ff1c79904799eb7 100644 (file)
--- a/src/sp-offset.cpp
+++ b/src/sp-offset.cpp
static void sp_offset_snappoints(SPItem const *item, SnapPointsIter p);
static void sp_offset_set_shape (SPShape * shape);
-Path *bpath_to_liv_path (NArtBpath * bpath);
+Path *bpath_to_liv_path (NArtBpath const * bpath);
static void refresh_offset_source(SPOffset* offset);
* livarot Path. Duplicate of splivarot.
*/
Path *
-bpath_to_liv_path(NArtBpath *bpath)
+bpath_to_liv_path(NArtBpath const *bpath)
{
if (bpath == NULL)
return NULL;
diff --git a/src/sp-path.cpp b/src/sp-path.cpp
index 86bc83e2b504efb50f2c391efbaaad18da134e06..14f04218f5e1476183e1c41dd9bd3485f1780c8e 100644 (file)
--- a/src/sp-path.cpp
+++ b/src/sp-path.cpp
SPCurve *curve = SP_SHAPE(path)->curve;
if (!curve) return;
- NArtBpath *bpath = SP_CURVE_BPATH(curve);
+ NArtBpath const *bpath = SP_CURVE_BPATH(curve);
NR::Point last_pt;
NR::Point pt;
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index fff9de7d3434fa56b2c35f4f722fb5f3b76abaf6..991381bda87a3b6ae5a54ad72fdea7cb449ff426 100644 (file)
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
* \return 1 if a marker is required here, otherwise 0.
*/
bool
-sp_shape_marker_required(SPShape const *shape, int const m, NArtBpath *bp)
+sp_shape_marker_required(SPShape const *shape, int const m, NArtBpath const *bp)
{
if (shape->marker[m] == NULL) {
return false;
int n = 0;
- for (NArtBpath *bp = SP_CURVE_BPATH(shape->curve); bp->code != NR_END; bp++) {
+ for (NArtBpath const *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,
@@ -637,7 +637,7 @@ static void sp_shape_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &tr
if (shape->curve) {
NRRect cbbox;
- NRBPath bp;
+ const_NRBPath bp;
bp.path = SP_CURVE_BPATH (shape->curve);
@@ -664,7 +664,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 = SP_CURVE_BPATH(shape->curve); bp->code != NR_END; bp++) {
+ for (NArtBpath const* 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)) {
SPStyle* style = SP_OBJECT_STYLE (item);
- if (!style->fill.isNone()) {
- NRBPath bp;
- bp.path = SP_CURVE_BPATH(shape->curve);
- sp_print_fill (ctx, &bp, &i2d, style, &pbox, &dbox, &bbox);
- }
+ if (!style->fill.isNone()) {
+ const_NRBPath bp;
+ bp.path = SP_CURVE_BPATH(shape->curve);
+ sp_print_fill (ctx, &bp, &i2d, style, &pbox, &dbox, &bbox);
+ }
- if (!style->stroke.isNone()) {
- NRBPath bp;
- bp.path = SP_CURVE_BPATH(shape->curve);
- sp_print_stroke (ctx, &bp, &i2d, style, &pbox, &dbox, &bbox);
- }
+ if (!style->stroke.isNone()) {
+ const_NRBPath bp;
+ bp.path = SP_CURVE_BPATH(shape->curve);
+ sp_print_stroke (ctx, &bp, &i2d, style, &pbox, &dbox, &bbox);
+ }
- for (NArtBpath* bp = SP_CURVE_BPATH(shape->curve); bp->code != NR_END; bp++) {
+ for (NArtBpath const* 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 = SP_CURVE_BPATH(shape->curve); bp->code != NR_END; bp++) {
+ for (NArtBpath const* bp = SP_CURVE_BPATH(shape->curve); bp->code != NR_END; bp++) {
if (sp_shape_marker_required (shape, type, bp)) {
n++;
}
diff --git a/src/sp-shape.h b/src/sp-shape.h
index cc25d2e88f9cf3d4d3a0fdd20d8137fe1fa4b260..d0bfc376a920616883c12d1f29682f578c1c1dc7 100644 (file)
--- a/src/sp-shape.h
+++ b/src/sp-shape.h
int sp_shape_has_markers (SPShape const *shape);
int sp_shape_number_of_markers (SPShape* Shape, int type);
NR::Matrix sp_shape_marker_get_transform(SPShape const *shape, NArtBpath const *bp);
-bool sp_shape_marker_required(SPShape const *shape, int const m, NArtBpath *bp);
+bool sp_shape_marker_required(SPShape const *shape, int const m, NArtBpath const *bp);
#endif
diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp
index d543aa00f234d6ac1935212988af5689f023dcf1..60f2bbc92efc24708f006450d2318ef8ce6796f1 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 = SP_CURVE_BPATH(curve);
+ NArtBpath const *bpath = SP_CURVE_BPATH(curve);
if ( !bpath ) {
//g_warning("sp_spiral_write(): No path to copy\n");
return NULL;
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index aec2b8f6e234dda1e9e51cf50fd5c00af8a2b4db..382f857cf1b54a456fd23184010f8c8af9703fc7 100644 (file)
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
SPShape *shape = SP_SHAPE(item);
- for (NArtBpath* bp = SP_CURVE_BPATH(shape->curve); bp->code != NR_END; bp++) {
+ for (NArtBpath const* 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)) {
Path *dest = bpath_to_Path(bpath);
- if (doTransformation) {
- g_free(bpath); // see comment in bpath_for_curve
- }
-
+ g_free(bpath);
+
curve->unref();
return dest;
}
/*
- * This function is buggy: it can either return a new NArtBpath, or an existing one.
- * It is therefore unclear whether the caller must g_free the path or not!
+ * This function always returns a new NArtBpath, the caller must g_free the returned path!
*/
NArtBpath *
bpath_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool transformFull)
@@ -1748,22 +1745,23 @@ bpath_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool transf
if (curve == NULL)
return NULL;
- NArtBpath *bpath = SP_CURVE_BPATH(curve);
+ NArtBpath const *bpath = SP_CURVE_BPATH(curve);
if (bpath == NULL) {
return NULL;
}
-
+
+ NArtBpath *new_bpath; // we will get a duplicate which has to be freed at some point!
if (doTransformation) {
- NArtBpath *new_bpath; // we will get a duplicate which has to be freed at some point!
if (transformFull) {
new_bpath = nr_artpath_affine(bpath, sp_item_i2doc_affine(item));
} else {
new_bpath = nr_artpath_affine(bpath, item->transform);
}
- bpath = new_bpath;
+ } else {
+ new_bpath = nr_artpath_affine(bpath, NR::identity());
}
- return bpath;
+ return new_bpath;
}
SPCurve* curve_for_item(SPItem *item)