diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2018-06-10 20:20:18 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2018-08-05 00:31:06 +0000 |
| commit | 850515e890b2bebbac5dcde3b04d3fc0cff52654 (patch) | |
| tree | 29bf5ff744acaedf5bc3ad5d7c831d6a618d2a71 /src/style-internal.cpp | |
| parent | Allow inkscape handle units and percent in dasharray and dashoffset. Add pref... (diff) | |
| download | inkscape-850515e890b2bebbac5dcde3b04d3fc0cff52654.tar.gz inkscape-850515e890b2bebbac5dcde3b04d3fc0cff52654.zip | |
Revert changes
Diffstat (limited to '')
| -rw-r--r-- | src/style-internal.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/style-internal.cpp b/src/style-internal.cpp index 4ed59e82e..17391c4bd 100644 --- a/src/style-internal.cpp +++ b/src/style-internal.cpp @@ -2034,17 +2034,20 @@ SPIDashArray::read( gchar const *str ) { return; } - std::vector<Glib::ustring> tokens = Glib::Regex::split_simple("[,\\s]+", str ); + // std::vector<Glib::ustring> tokens = Glib::Regex::split_simple("[,\\s]+", str ); + gchar *e = NULL; bool LineSolid = true; - for (auto token:tokens) { - SVGLength svglength; - double value = atof(token.c_str()); - if(value > 0.00000001) { + while (e != str && *str != '\0') { + /* TODO: Should allow <length> rather than just a unitless (px) number. */ + double number = g_ascii_strtod(str, (char **) &e); + values.push_back( number ); + if (number > 0.00000001) LineSolid = false; + if (e != str) { + str = e; } - svglength.read(token.c_str()); - values.push_back(svglength); + while (str && *str && !(isalnum(*str) || *str=='.')) str += 1; } if (LineSolid) { @@ -2071,7 +2074,7 @@ SPIDashArray::write( guint const flags, SPStyleSrc const &style_src_req, SPIBase if (i) { os << ", "; } - os << this->values[i].write().c_str(); + os << this->values[i]; } os << important_str(); os << ";"; @@ -2085,9 +2088,7 @@ SPIDashArray::write( guint const flags, SPStyleSrc const &style_src_req, SPIBase void SPIDashArray::cascade( const SPIBase* const parent ) { if( const SPIDashArray* p = dynamic_cast<const SPIDashArray*>(parent) ) { - if( !set || inherit ) { - values = p->values; // Always inherits - } + if( !set || inherit ) values = p->values; // Always inherits } else { std::cerr << "SPIDashArray::cascade(): Incorrect parent type" << std::endl; } @@ -2111,13 +2112,10 @@ SPIDashArray::merge( const SPIBase* const parent ) { bool SPIDashArray::operator==(const SPIBase& rhs) { if( const SPIDashArray* r = dynamic_cast<const SPIDashArray*>(&rhs) ) { - for (int i = 0;i < values.size(); i++) { - if (values[i] != r->values[i]) { - return false; - } - } + return values == r->values && SPIBase::operator==(rhs); + } else { + return false; } - return SPIBase::operator==(rhs); } |
