summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2018-02-26 23:19:22 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2018-05-09 19:42:10 +0000
commit0624d93323c24936b9bc83c9836e87c6645b8582 (patch)
treeec04596b0b9346bf0d61c982fb372f90834bf982
parentAdd patch to branch https://inkscape.org/en/paste/10993/ (diff)
downloadinkscape-0624d93323c24936b9bc83c9836e87c6645b8582.tar.gz
inkscape-0624d93323c24936b9bc83c9836e87c6645b8582.zip
Fix https://gitlab.com/inkscape/inkscape/merge_requests/208#note_60693688
-rw-r--r--src/attribute-rel-util.cpp9
-rw-r--r--src/extension/implementation/script.cpp21
-rw-r--r--src/preferences-skeleton.h1
-rw-r--r--src/svg/path-string.cpp7
-rw-r--r--src/svg/svg-color.cpp3
-rw-r--r--src/xml/repr-io.cpp5
6 files changed, 20 insertions, 26 deletions
diff --git a/src/attribute-rel-util.cpp b/src/attribute-rel-util.cpp
index 42b6bebf2..d377e5edb 100644
--- a/src/attribute-rel-util.cpp
+++ b/src/attribute-rel-util.cpp
@@ -34,11 +34,14 @@ unsigned int sp_attribute_clean_get_prefs() {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
unsigned int flags = 0;
if( prefs->getBool("/options/svgoutput/incorrect_attributes_warn") ) flags += SP_ATTR_CLEAN_ATTR_WARN;
- if( prefs->getBool("/options/svgoutput/incorrect_attributes_remove") ) flags += SP_ATTR_CLEAN_ATTR_REMOVE;
+ if( prefs->getBool("/options/svgoutput/incorrect_attributes_remove") &&
+ !prefs->getBool("/options/svgoutput/disable_optimizations" ) ) flags += SP_ATTR_CLEAN_ATTR_REMOVE;
if( prefs->getBool("/options/svgoutput/incorrect_style_properties_warn") ) flags += SP_ATTR_CLEAN_STYLE_WARN;
- if( prefs->getBool("/options/svgoutput/incorrect_style_properties_remove" ) ) flags += SP_ATTR_CLEAN_STYLE_REMOVE;
+ if( prefs->getBool("/options/svgoutput/incorrect_style_properties_remove" ) &&
+ !prefs->getBool("/options/svgoutput/disable_optimizations" ) ) flags += SP_ATTR_CLEAN_STYLE_REMOVE;
if( prefs->getBool("/options/svgoutput/style_defaults_warn") ) flags += SP_ATTR_CLEAN_DEFAULT_WARN;
- if( prefs->getBool("/options/svgoutput/style_defaults_remove") ) flags += SP_ATTR_CLEAN_DEFAULT_REMOVE;
+ if( prefs->getBool("/options/svgoutput/style_defaults_remove") &&
+ !prefs->getBool("/options/svgoutput/disable_optimizations" ) ) flags += SP_ATTR_CLEAN_DEFAULT_REMOVE;
return flags;
}
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp
index 42867b823..f1b46e8ac 100644
--- a/src/extension/implementation/script.cpp
+++ b/src/extension/implementation/script.cpp
@@ -418,28 +418,11 @@ ScriptDocCache::ScriptDocCache (Inkscape::UI::View::View * view) :
SPDesktop *desktop = (SPDesktop *) view;
sp_namedview_document_from_window(desktop);
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- bool sort_attributes = prefs->getBool("/options/svgoutput/sort_attributes", false);
- bool incorrect_style_properties_remove = prefs->getBool("/options/svgoutput/incorrect_style_properties_remove", false);
- bool incorrect_attributes_remove = prefs->getBool("/options/svgoutput/incorrect_attributes_remove", false);
- bool usenamedcolors = prefs->getBool("/options/svgoutput/usenamedcolors", false);
- bool forcerepeatcommands = prefs->getBool("/options/svgoutput/forcerepeatcommands", false);
- bool style_defaults_remove = prefs->getBool("/options/svgoutput/style_defaults_remove", false);
- prefs->setBool("/options/svgoutput/sort_attributes", false);
- prefs->setBool("/options/svgoutput/incorrect_style_properties_remove", false);
- prefs->setBool("/options/svgoutput/incorrect_attributes_remove", false);
- prefs->setBool("/options/svgoutput/usenamedcolors", false);
- prefs->setBool("/options/svgoutput/forcerepeatcommands", false);
- prefs->setBool("/options/svgoutput/style_defaults_remove", false);
+ prefs->setBool("/options/svgoutput/disable_optimizations", true);
Inkscape::Extension::save(
Inkscape::Extension::db.get(SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE),
view->doc(), _filename.c_str(), false, false, false, Inkscape::Extension::FILE_SAVE_METHOD_TEMPORARY);
-
- prefs->setBool("/options/svgoutput/sort_attributes", sort_attributes);
- prefs->setBool("/options/svgoutput/incorrect_style_properties_remove", incorrect_style_properties_remove);
- prefs->setBool("/options/svgoutput/incorrect_attributes_remove", incorrect_attributes_remove);
- prefs->setBool("/options/svgoutput/usenamedcolors", usenamedcolors);
- prefs->setBool("/options/svgoutput/forcerepeatcommands", forcerepeatcommands);
- prefs->setBool("/options/svgoutput/style_defaults_remove", style_defaults_remove);
+ prefs->setBool("/options/svgoutput/disable_optimizations", false);
return;
}
diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h
index ed00092b2..23040fcfd 100644
--- a/src/preferences-skeleton.h
+++ b/src/preferences-skeleton.h
@@ -323,6 +323,7 @@ static char const preferences_skeleton[] =
" clips=\"16711935\"" // 00ff00ff
" masks=\"65535\"/>\n" // 0x0000ffff
" <group id=\"svgoutput\" "
+" disable_optimizations=\"0\" "
" usenamedcolors=\"0\" "
" numericprecision=\"8\" "
" minimumexponent=\"-8\" "
diff --git a/src/svg/path-string.cpp b/src/svg/path-string.cpp
index 7d0092dfa..a1dd3e49c 100644
--- a/src/svg/path-string.cpp
+++ b/src/svg/path-string.cpp
@@ -26,9 +26,12 @@ static int const maxprec = 16;
int Inkscape::SVG::PathString::numericprecision;
int Inkscape::SVG::PathString::minimumexponent;
Inkscape::SVG::PATHSTRING_FORMAT Inkscape::SVG::PathString::format;
-
+bool forcerepeatcommands = prefs->getBool("/options/svgoutput/disable_optimizations" );
+if (!forcerepeatcommands) {
+ forcerepeatcommands = Inkscape::Preferences::get()->getBool("/options/svgoutput/forcerepeatcommands");
+}
Inkscape::SVG::PathString::PathString() :
- force_repeat_commands(Inkscape::Preferences::get()->getBool("/options/svgoutput/forcerepeatcommands"))
+ force_repeat_commands(forcerepeatcommands)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
format = (PATHSTRING_FORMAT)prefs->getIntLimited("/options/svgoutput/pathstring_format", 1, 0, PATHSTRING_FORMAT_SIZE - 1 );
diff --git a/src/svg/svg-color.cpp b/src/svg/svg-color.cpp
index d1e91ace1..1f26d02b1 100644
--- a/src/svg/svg-color.cpp
+++ b/src/svg/svg-color.cpp
@@ -491,7 +491,8 @@ void sp_svg_write_color(gchar *buf, unsigned const buflen, guint32 const rgba32)
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
unsigned const rgb24 = rgba32 >> 8;
- if (prefs->getBool("/options/svgoutput/usenamedcolors")) {
+ if ( prefs->getBool("/options/svgoutput/usenamedcolors") &&
+ !prefs->getBool("/options/svgoutput/disable_optimizations" )) {
rgb24_to_css(buf, rgb24);
} else {
g_snprintf(buf, buflen, "#%06x", rgb24);
diff --git a/src/xml/repr-io.cpp b/src/xml/repr-io.cpp
index 2ff9d4776..c7b483dcb 100644
--- a/src/xml/repr-io.cpp
+++ b/src/xml/repr-io.cpp
@@ -872,7 +872,10 @@ static void sp_repr_write_stream_root_element(Node *repr, Writer &out,
if (clean) sp_attribute_clean_tree( repr );
// Sort attributes in a canonical order (helps with "diffing" SVG files).
- bool sort = prefs->getBool("/options/svgoutput/sort_attributes");
+ bool sort = prefs->getBool("/options/svgoutput/disable_optimizations");
+ if (!sort) {
+ sort = prefs->getBool("/options/svgoutput/sort_attributes");
+ }
if (sort) sp_attribute_sort_tree( repr );
Glib::QueryQuark xml_prefix=g_quark_from_static_string("xml");