diff options
author | woglinde <woglinde@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2010-06-12 00:00:45 +0000 |
---|---|---|
committer | woglinde <woglinde@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2010-06-12 00:00:45 +0000 |
commit | 93a5e1226c4371e1c3e5c7dc5dc522c316bd5027 (patch) | |
tree | b13f79a17fb24597abbeb389f6bd7df3b176a44a /navit/graphics/qt_qpainter | |
parent | ffceb94cf34cb8dc6c255a08f51011dfd630dd39 (diff) | |
download | navit-93a5e1226c4371e1c3e5c7dc5dc522c316bd5027.tar.gz |
Add:graphics/qt_qpainter: Add feature to load svg's directly
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@3358 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/graphics/qt_qpainter')
-rw-r--r-- | navit/graphics/qt_qpainter/Makefile.am | 4 | ||||
-rw-r--r-- | navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp | 20 |
2 files changed, 20 insertions, 4 deletions
diff --git a/navit/graphics/qt_qpainter/Makefile.am b/navit/graphics/qt_qpainter/Makefile.am index cfd5e7f6f..e5740f2e2 100644 --- a/navit/graphics/qt_qpainter/Makefile.am +++ b/navit/graphics/qt_qpainter/Makefile.am @@ -1,8 +1,8 @@ include $(top_srcdir)/Makefile.inc -AM_CPPFLAGS = @QT_GUI_CFLAGS@ @NAVIT_CFLAGS@ -I$(top_srcdir) -I$(top_srcdir)/navit -DMODULE=graphics_qt_qpainter +AM_CPPFLAGS = @QT_GUI_CFLAGS@ @QT_SVG_CFLAGS@ @NAVIT_CFLAGS@ -I$(top_srcdir) -I$(top_srcdir)/navit -DMODULE=graphics_qt_qpainter modulegraphics_LTLIBRARIES = libgraphics_qt_qpainter.la libgraphics_qt_qpainter_la_SOURCES = graphics_qt_qpainter.cpp graphics_qt_qpainter.moc -libgraphics_qt_qpainter_la_LDFLAGS = @QT_GUI_LIBS@ -module -avoid-version +libgraphics_qt_qpainter_la_LDFLAGS = @QT_GUI_LIBS@ @QT_SVG_LIBS@ -module -avoid-version if GRAPHICS_QT_QPAINTER BUILT_SOURCES = graphics_qt_qpainter.moc graphics_qt_qpainter.moc: diff --git a/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp b/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp index 84d83e6d0..15a6b1fc5 100644 --- a/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp +++ b/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp @@ -82,6 +82,7 @@ #include <QWidget> #include <QPolygonF> #include <QtGui> +#include <QSvgRenderer> #ifndef QT_QPAINTER_USE_EVENT_GLIB #define QT_QPAINTER_USE_EVENT_GLIB 1 @@ -644,8 +645,23 @@ static struct graphics_image_priv * image_new(struct graphics_priv *gr, struct g cachedPixmap=QPixmapCache::find(key); if (!cachedPixmap) { - - ret->pixmap=new QPixmap(path); + if(key.endsWith(".svg", Qt::CaseInsensitive)) { + QSvgRenderer renderer(key); + if (!renderer.isValid()) { + g_free(ret); + return NULL; + } + ret->pixmap=new QPixmap(renderer.defaultSize()); + ret->pixmap->fill(Qt::transparent); + QPainter painter(ret->pixmap); + renderer.render(&painter); + + } else { + + ret->pixmap=new QPixmap(path); + + } + if (ret->pixmap->isNull()) { g_free(ret); return NULL; |