summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJasper van de Gronde <jasper.vandegronde@gmail.com>2008-04-28 15:53:11 +0000
committerjaspervdg <jaspervdg@users.sourceforge.net>2008-04-28 15:53:11 +0000
commit38cb0859ae202363b22fd28c4629171552b16bd2 (patch)
tree6a9c2c0f372fbdc4a724fbf7785b7c9d8392cfb8 /src
parentRefining eraser (diff)
downloadinkscape-38cb0859ae202363b22fd28c4629171552b16bd2.tar.gz
inkscape-38cb0859ae202363b22fd28c4629171552b16bd2.zip
Fix for closepath handling of SVG path data parser and tolerance for approximately closed check in gnome-canvas-bpath-util.cpp.
(bzr r5536)
Diffstat (limited to 'src')
-rw-r--r--src/svg/gnome-canvas-bpath-util.cpp4
-rw-r--r--src/svg/svg-path.cpp6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/svg/gnome-canvas-bpath-util.cpp b/src/svg/gnome-canvas-bpath-util.cpp
index ab67b20be..49a4162fb 100644
--- a/src/svg/gnome-canvas-bpath-util.cpp
+++ b/src/svg/gnome-canvas-bpath-util.cpp
@@ -31,7 +31,7 @@ static inline NR::Point distTo(GnomeCanvasBpathDef *bpd, size_t idx1, size_t idx
static bool isApproximatelyClosed(GnomeCanvasBpathDef *bpd) {
int const np = prefs_get_int_attribute("options.svgoutput", "numericprecision", 8);
- double const precision = pow(10.0, -np); // This roughly corresponds to a difference below the last significant digit
+ double const precision = 5*pow(10.0, -np); // This roughly corresponds to a difference below the last significant digit
int const initial = bpd->moveto_idx;
int const current = bpd->n_bpath - 1;
int const previous = bpd->n_bpath - 2;
@@ -187,8 +187,6 @@ gnome_canvas_bpath_def_closepath (GnomeCanvasBpathDef *bpd)
// If it is approximately closed we close it here to prevent internal logic to fail.
// In addition it is probably better to continue working with this end point, as it
// is probably more precise than the original.
- // NOTE: At the very least sp_bpath_check_subpath will fail, but it is not unreasonable
- // to assume that there might be more places where similar problems would occur.
bpath[n_bpath-1].x3 = bpath[bpd->moveto_idx].x3;
bpath[n_bpath-1].y3 = bpath[bpd->moveto_idx].y3;
}
diff --git a/src/svg/svg-path.cpp b/src/svg/svg-path.cpp
index c645133a6..3823071b0 100644
--- a/src/svg/svg-path.cpp
+++ b/src/svg/svg-path.cpp
@@ -386,12 +386,14 @@ static void rsvg_parse_path_do_cmd(RSVGParsePathCtx *ctx, bool final, const char
if (ctx->param == 0)
{
rsvg_bpath_def_closepath (ctx->bpath);
+ ctx->cpx = ctx->rpx = ctx->spx;
+ ctx->cpy = ctx->rpy = ctx->spy;
if (next_cmd != 0 && next_cmd != 'm') {
// This makes sure we do the right moveto if the closepath is followed by anything other than a moveto
ctx->cmd = 'm';
- ctx->params[0] = ctx->cpx = ctx->rpx = ctx->spx;
- ctx->params[1] = ctx->cpy = ctx->rpy = ctx->spy;
+ ctx->params[0] = ctx->cpx;
+ ctx->params[1] = ctx->cpy;
ctx->param = 2;
rsvg_parse_path_do_cmd(ctx, final, next_cmd);
}