From f754c8e360b4380e21fd0fd627431b311e873f22 Mon Sep 17 00:00:00 2001 From: Jasper van de Gronde Date: Mon, 30 Jun 2008 08:33:46 +0000 Subject: Approximately closed test for path parsing now looks at the absolute coordinate values again (in accordance with how PathString used to work before and relative coordinates, and how it works now). (bzr r6097) --- src/svg/gnome-canvas-bpath-util.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/svg/gnome-canvas-bpath-util.cpp b/src/svg/gnome-canvas-bpath-util.cpp index 49a4162fb..5c94f1e1b 100644 --- a/src/svg/gnome-canvas-bpath-util.cpp +++ b/src/svg/gnome-canvas-bpath-util.cpp @@ -31,16 +31,13 @@ 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 = 5*pow(10.0, -np); // This roughly corresponds to a difference below the last significant digit + double const precision = pow(10.0, -(np+1)); // 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; - NR::Point distToPrev(distTo(bpd, current, previous)); NR::Point distToInit(distTo(bpd, current, initial)); - // NOTE: It would be better to determine the uncertainty while parsing, in rsvg_parse_path_data, but this seems to perform reasonably well return - distToInit[NR::X] <= distToPrev[NR::X]*precision && - distToInit[NR::Y] <= distToPrev[NR::Y]*precision; + distToInit[NR::X] <= abs(bpd->bpath[current].c(3)[NR::X])*precision && + distToInit[NR::Y] <= abs(bpd->bpath[current].c(3)[NR::Y])*precision; } GnomeCanvasBpathDef * -- cgit v1.2.3