Mercurial > octave
diff src/octave-svgconvert.cc @ 31228:4c1be4d6d0d1
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".
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Thu, 01 Sep 2022 22:32:29 +0200 |
parents | 55415fa6a20f |
children | 24bd675bceab |
line wrap: on
line diff
--- 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")) {