diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2022-03-10 13:29:18 +0200 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2022-03-10 13:29:18 +0200 |
commit | d52839aabbba103f273dbae5c17a59d646598d1d (patch) | |
tree | 6543ce0302db024abc2d7f8ef5e7e41909938176 /tdecore/svgicons/ksvgiconengine.cpp | |
parent | 2fcbb8f256f515bec9b5db93743f281b00aba827 (diff) | |
download | tdelibs-feat/tdehtml+svg.tar.gz tdelibs-feat/tdehtml+svg.zip |
svgicons: API changes proposalfeat/tdehtml+svg
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
Diffstat (limited to 'tdecore/svgicons/ksvgiconengine.cpp')
-rw-r--r-- | tdecore/svgicons/ksvgiconengine.cpp | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/tdecore/svgicons/ksvgiconengine.cpp b/tdecore/svgicons/ksvgiconengine.cpp index 97e60fcb7..2866739ed 100644 --- a/tdecore/svgicons/ksvgiconengine.cpp +++ b/tdecore/svgicons/ksvgiconengine.cpp @@ -18,7 +18,6 @@ Boston, MA 02110-1301, USA. */ -#include <tqdom.h> #include <tqfile.h> #include <tqcolor.h> #include <tqimage.h> @@ -540,7 +539,7 @@ KSVGIconEngine::~KSVGIconEngine() delete d; } -bool KSVGIconEngine::load(int width, int height, const TQString &path) +bool KSVGIconEngine::load(const TQString &path, int width, int height) { if(path.isNull()) return false; @@ -585,11 +584,24 @@ bool KSVGIconEngine::load(int width, int height, const TQString &path) svgDocument.setContent(buffer); } - if(svgDocument.isNull()) + return parse(svgDocument, width, height); +} + +bool KSVGIconEngine::load(int width, int height, const TQString &path) +{ + return load(path, width, height); +} + + +bool KSVGIconEngine::parse(const TQDomDocument& data, int width, int height) +{ + if(data.isNull()) + { return false; + } // Check for root element - TQDomNode rootNode = svgDocument.namedItem("svg"); + TQDomNode rootNode = data.namedItem("svg"); if(rootNode.isNull() || !rootNode.isElement()) return false; @@ -691,6 +703,19 @@ bool KSVGIconEngine::load(int width, int height, const TQString &path) return true; } +bool KSVGIconEngine::parse(const TQString& data, int width, int height) +{ + if(data.isNull()) + { + return false; + } + + TQDomDocument svgDocument("svg"); + svgDocument.setContent(data); + + return parse(svgDocument, width, height); +} + KSVGIconPainter *KSVGIconEngine::painter() { return d->painter; |