# HG changeset patch # User Pantxo Diribarne # Date 1662064349 -7200 # Node ID 4c1be4d6d0d109c26ed3adc5d4741e55c1bffb59 # Parent 0dec459a40643742402518e089894ea099714b15 Hint SVG renderers to not interpolate images (bug #62998) * octave-svgconvert.cc (add_custom_properites): New function that currently only sets the "image-rendering" attribute of image elements to "optimizeSpeed". diff -r 0dec459a4064 -r 4c1be4d6d0d1 src/octave-svgconvert.cc --- a/src/octave-svgconvert.cc Wed Sep 14 09:59:31 2022 -0400 +++ b/src/octave-svgconvert.cc Thu Sep 01 22:32:29 2022 +0200 @@ -827,6 +827,26 @@ replace_polygons (parent_elt, collection[ii].first, collection[ii].second); } +void add_custom_properties (QDomElement& parent_elt) +{ + QDomNodeList nodes = parent_elt.childNodes (); + + for (int ii = 0; ii < nodes.count (); ii++) + { + QDomNode node = nodes.at (ii); + if (! node.isElement ()) + continue; + + QDomElement elt = node.toElement (); + + if (elt.tagName () == "image") + elt.setAttribute ("image-rendering", "optimizeSpeed"); + else + add_custom_properties (elt); + } + +} + #if defined (OCTAVE_USE_WINDOWS_API) && defined (_UNICODE) extern "C" int @@ -963,6 +983,9 @@ if (QString (argv[5]).toInt ()) reconstruct_polygons (root); + // Add custom properties to SVG + add_custom_properties (root); + // Draw if (! strcmp (argv[2], "pdf")) {