From bb5018e116c7323c2ae54618135174891ffbe7fc Mon Sep 17 00:00:00 2001 From: Peter Moulder Date: Mon, 13 Jul 2009 03:24:24 +0000 Subject: sp-star.cpp, star-context.cpp: s/CLAMP/NR_CLAMP/, to make clear (and ensure) that we're using the libnr version rather than the glib version. (This change is probably desirable in most of Inkscape, but star-related code in particular is known to be sensitive to the difference.) (bzr r8273) --- src/sp-star.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/sp-star.cpp') diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 3c8754a11..71c9ad1c7 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -174,7 +174,7 @@ sp_star_set (SPObject *object, unsigned int key, const gchar *value) case SP_ATTR_SODIPODI_SIDES: if (value) { star->sides = atoi (value); - star->sides = CLAMP (star->sides, 3, 1024); + star->sides = NR_CLAMP(star->sides, 3, 1024); } else { star->sides = 5; } @@ -512,13 +512,13 @@ sp_star_position_set (SPStar *star, gint sides, Geom::Point center, gdouble r1, g_return_if_fail (star != NULL); g_return_if_fail (SP_IS_STAR (star)); - star->sides = CLAMP (sides, 3, 1024); + star->sides = NR_CLAMP(sides, 3, 1024); star->center = center; star->r[0] = MAX (r1, 0.001); if (isflat == false) { - star->r[1] = CLAMP (r2, 0.0, star->r[0]); + star->r[1] = NR_CLAMP(r2, 0.0, star->r[0]); } else { - star->r[1] = CLAMP ( r1*cos(M_PI/sides) ,0.0, star->r[0] ); + star->r[1] = NR_CLAMP( r1*cos(M_PI/sides) ,0.0, star->r[0] ); } star->arg[0] = arg1; star->arg[1] = arg2; -- cgit v1.2.3 From 8b04d0db6c55e36935690d37defb6f9b68945796 Mon Sep 17 00:00:00 2001 From: johnce Date: Wed, 5 Aug 2009 05:40:36 +0000 Subject: SPDocument->Document (bzr r8404) --- src/sp-star.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/sp-star.cpp') diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 71c9ad1c7..88b24aa77 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -33,7 +33,7 @@ static void sp_star_class_init (SPStarClass *klass); static void sp_star_init (SPStar *star); -static void sp_star_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); +static void sp_star_build (SPObject * object, Document * document, Inkscape::XML::Node * repr); static Inkscape::XML::Node *sp_star_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_star_set (SPObject *object, unsigned int key, const gchar *value); static void sp_star_update (SPObject *object, SPCtx *ctx, guint flags); @@ -111,7 +111,7 @@ sp_star_init (SPStar * star) } static void -sp_star_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr) +sp_star_build (SPObject * object, Document * document, Inkscape::XML::Node * repr) { if (((SPObjectClass *) parent_class)->build) ((SPObjectClass *) parent_class)->build (object, document, repr); -- cgit v1.2.3 From 51c2905fd3e99955db2d823b79abb763d8097028 Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Thu, 6 Aug 2009 14:17:17 +0000 Subject: Revert recent refactoring changes by johnce because they break the build, which cannot be fixed easily. (bzr r8422) --- src/sp-star.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/sp-star.cpp') diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 88b24aa77..71c9ad1c7 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -33,7 +33,7 @@ static void sp_star_class_init (SPStarClass *klass); static void sp_star_init (SPStar *star); -static void sp_star_build (SPObject * object, Document * document, Inkscape::XML::Node * repr); +static void sp_star_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); static Inkscape::XML::Node *sp_star_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_star_set (SPObject *object, unsigned int key, const gchar *value); static void sp_star_update (SPObject *object, SPCtx *ctx, guint flags); @@ -111,7 +111,7 @@ sp_star_init (SPStar * star) } static void -sp_star_build (SPObject * object, Document * document, Inkscape::XML::Node * repr) +sp_star_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr) { if (((SPObjectClass *) parent_class)->build) ((SPObjectClass *) parent_class)->build (object, document, repr); -- cgit v1.2.3 From 6c059afd9ecdd6fc153e8e9ce0a9e5817fa3086c Mon Sep 17 00:00:00 2001 From: bulia byak Date: Sat, 22 Aug 2009 21:49:32 +0000 Subject: fix rendering of testcase errorhandling-nosuchlpe.svg: make sure shapes do not calculate the curve if they have a broken lpe, instead reading it directly from d= and issuing a warning (bzr r8520) --- src/sp-star.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'src/sp-star.cpp') diff --git a/src/sp-star.cpp b/src/sp-star.cpp index 71c9ad1c7..9cffd952c 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -28,6 +28,8 @@ #include "xml/repr.h" #include "document.h" +#include <2geom/pathvector.h> + #include "sp-star.h" static void sp_star_class_init (SPStarClass *klass); @@ -428,6 +430,21 @@ sp_star_set_shape (SPShape *shape) { SPStar *star = SP_STAR (shape); + // perhaps we should convert all our shapes into LPEs without source path + // and with knotholders for parameters, then this situation will be handled automatically + // by disabling the entire stack (including the shape LPE) + if (sp_lpe_item_has_broken_path_effect(SP_LPE_ITEM(shape))) { + g_warning ("The star shape has unknown LPE on it! Convert to path to make it editable preserving the appearance; editing it as star will remove the bad LPE"); + if (SP_OBJECT_REPR(shape)->attribute("d")) { + // unconditionally read the curve from d, if any, to preserve appearance + Geom::PathVector pv = sp_svg_read_pathv(SP_OBJECT_REPR(shape)->attribute("d")); + SPCurve *cold = new SPCurve(pv); + sp_shape_set_curve_insync (shape, cold, TRUE); + cold->unref(); + } + return; + } + SPCurve *c = new SPCurve (); gint sides = star->sides; @@ -500,7 +517,7 @@ sp_star_set_shape (SPShape *shape) bool success = sp_lpe_item_perform_path_effect(SP_LPE_ITEM (shape), c_lpe); if (success) { sp_shape_set_curve_insync (shape, c_lpe, TRUE); - } + } c_lpe->unref(); } c->unref(); @@ -587,3 +604,13 @@ sp_star_get_xy (SPStar *star, SPStarPoint point, gint index, bool randomized) } } +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : -- cgit v1.2.3