From dac72fcd64d2fb7e216d5165a8821b722d2eded9 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Wed, 15 Aug 2018 11:11:55 +0200 Subject: Relative values for strokes: Fix segmenation fault on reading dashes with % values. Fix computed value for dashes with % values (use viewport diagonal length). Support % values for stroke width. --- src/style-internal.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src/style-internal.cpp') diff --git a/src/style-internal.cpp b/src/style-internal.cpp index 14b523302..39e334d1f 100644 --- a/src/style-internal.cpp +++ b/src/style-internal.cpp @@ -2052,9 +2052,9 @@ SPIDashArray::read( gchar const *str ) { if( strcmp(str, "none") == 0) { return; } + std::vector tokens = Glib::Regex::split_simple("[(,\\s|\\s)]+", str); - gchar *e = NULL; bool LineSolid = true; for (auto token : tokens) { @@ -2062,21 +2062,9 @@ SPIDashArray::read( gchar const *str ) { spilength.read(token.c_str()); if (spilength.value > 0.00000001) LineSolid = false; - double dash = spilength.value; - // Currently inkscape handle unit conversion in dasharray but need - // a active document to do it, so put document inside a check for units - // and supose units are not included in tests - if (spilength.unit == SPCSSUnit::SP_CSS_UNIT_PERCENT) { - SPDocument *document = SP_ACTIVE_DOCUMENT; - dash = document->getViewBox().width() * spilength.value; - } - else if (spilength.unit != SPCSSUnit::SP_CSS_UNIT_NONE) { - SPDocument *document = SP_ACTIVE_DOCUMENT; - dash = spilength.computed / document->getDocumentScale()[0]; - } - spilength.setDouble(dash); values.push_back(spilength); } + if (LineSolid) { values.clear(); } -- cgit v1.2.3