summaryrefslogtreecommitdiffstats
path: root/src/sp-star.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2009-08-22 21:49:32 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2009-08-22 21:49:32 +0000
commit6c059afd9ecdd6fc153e8e9ce0a9e5817fa3086c (patch)
tree95b3520ec96e0f8ad5f695f4d70ca483848ab9e2 /src/sp-star.cpp
parentfix 272408 and address fixmes: fix inheriting of dasharray and dashoffset, ma... (diff)
downloadinkscape-6c059afd9ecdd6fc153e8e9ce0a9e5817fa3086c.tar.gz
inkscape-6c059afd9ecdd6fc153e8e9ce0a9e5817fa3086c.zip
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)
Diffstat (limited to 'src/sp-star.cpp')
-rw-r--r--src/sp-star.cpp29
1 files changed, 28 insertions, 1 deletions
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 :