summaryrefslogtreecommitdiffstats
path: root/mandriva/2010.2/other/ksplash-engine-moodin/moodin-external_svgrender.patch
blob: 6c0a5e900233fcbbeb2c79b708d4ab4463655893 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
diff -p -up moodin/src/cache.cpp.external_svgrender moodin/src/cache.cpp
--- moodin/src/cache.cpp.external_svgrender	2007-12-20 15:15:29.000000000 -0200
+++ moodin/src/cache.cpp	2007-12-20 16:12:35.000000000 -0200
@@ -13,9 +13,9 @@
 #include <kstandarddirs.h>
 #include <kconfig.h>
 
-#ifdef HAVE_LIBART
-#include <ksvgiconengine.h>
-#endif
+// for external svg rendering
+#include <ktempfile.h>
+#include <kprocess.h>
 
 #include <qfileinfo.h>
 #include <qdatetime.h>
@@ -49,22 +49,18 @@ QImage* Cache::cacheFile(const QString& 
   {
     QImage *i;
     if (file.endsWith(".svg") || file.endsWith(".svgz")) {
-#ifdef HAVE_LIBART
-      KSVGIconEngine* svgEngine = new KSVGIconEngine();
-      QSize size = mScaler->targetResolution(); 
-      if (svgEngine->load(size.width(), size.height(), file )) {
-         QImage *image = svgEngine->image();
-	 i = new QImage(*image);
-	 delete image;
-	 i->save(cachedFile.name(), QImage::imageFormat(file));
-      } else {
-         kdWarning() << "failed to load SVG file " << file << endl;
-      }
-        delete svgEngine;
-#else
-     kdWarning() << k_funcinfo
-                 << "tried to load SVG file but libart not installed" << endl;
-#endif	
+      QSize size = mScaler->targetResolution();
+      KProcess proc;
+	  proc << "moodin_svgrender";
+	  KTempFile tmp("/tmp/moodin_cache", ".png");
+	  tmp.setAutoDelete(false);
+	  tmp.close();
+	  proc << QString::number(size.width()) << QString::number(size.height()) << file << tmp.name();
+	  proc.start(KProcess::Block);
+
+      i = new QImage(tmp.name());
+	  if (i->save(cachedFile.name(), "PNG"))
+		 QFile(tmp.name()).remove();
     }
     else
     {