diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2018-06-17 20:51:09 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2018-08-05 00:31:06 +0000 |
| commit | a989bfb85b3827e97881b096c11f4fa6beb58496 (patch) | |
| tree | 80f3c8301a3d5eddf1f0b9eabdeafdb3256ab9a4 /src/style-internal.cpp | |
| parent | Refactor with Tav help (diff) | |
| download | inkscape-a989bfb85b3827e97881b096c11f4fa6beb58496.tar.gz inkscape-a989bfb85b3827e97881b096c11f4fa6beb58496.zip | |
Fixes compiling bugs
Diffstat (limited to 'src/style-internal.cpp')
| -rw-r--r-- | src/style-internal.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/style-internal.cpp b/src/style-internal.cpp index 400ef2e77..d58eaf51e 100644 --- a/src/style-internal.cpp +++ b/src/style-internal.cpp @@ -483,7 +483,7 @@ SPILength::toString( guint const flags, SPStyleSrc const &style_src_req, SPIBase } bool -SPILength::operator==(const SPIBase& rhs) const { +SPILength::operator==(const SPIBase& rhs) { if( const SPILength* r = dynamic_cast<const SPILength*>(&rhs) ) { if( unit != r->unit ) return false; @@ -2083,24 +2083,26 @@ SPIDashArray::read( gchar const *str ) { if( strcmp(str, "none") == 0) { return; } - std::vector<Glib::ustring> tokens = Glib::Regex::split_simple("[,\\s]+", str ); + std::vector<Glib::ustring> tokens = Glib::Regex::split_simple("[(,\\s|\\s)]+", str ); gchar *e = NULL; bool LineSolid = true; - SPDocument * document = SP_ACTIVE_DOCUMENT; - Geom::Rect vbox = document->getViewBox(); + SPDocument *document = NULL; + if ( style) { + document = (style->object) ? style->object->document : NULL; + } for (auto token:tokens) { SPILength spilength; spilength.read(token.c_str()); if(spilength.value > 0.00000001) LineSolid = false; - double dash = 0; - if(spilength.unit == SPCSSUnit::SP_CSS_UNIT_NONE) { - dash = spilength.value; - } else if (spilength.unit == SPCSSUnit::SP_CSS_UNIT_PERCENT) { - dash = vbox.width() * spilength.value; - } else { - dash = spilength.computed / document->getDocumentScale()[0]; + double dash = spilength.value; + if (document) { + if (spilength.unit == SPCSSUnit::SP_CSS_UNIT_PERCENT) { + dash = document->getViewBox().width() * spilength.value; + } else if(spilength.unit != SPCSSUnit::SP_CSS_UNIT_NONE) { + dash = spilength.computed / document->getDocumentScale()[0]; + } } Inkscape::CSSOStringStream osarray; osarray << dash; |
