summaryrefslogtreecommitdiff
path: root/navit/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'navit/graphics')
-rw-r--r--navit/graphics/qt5/graphics_qt5.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/navit/graphics/qt5/graphics_qt5.cpp b/navit/graphics/qt5/graphics_qt5.cpp
index 198bcb9c7..73095d759 100644
--- a/navit/graphics/qt5/graphics_qt5.cpp
+++ b/navit/graphics/qt5/graphics_qt5.cpp
@@ -140,6 +140,10 @@ gc_set_linewidth(struct graphics_gc_priv *gc, int w)
static void
gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n)
{
+ if(n <= 0)
+ {
+ dbg(lvl_error, "Refuse to set dashes without dash pattern");
+ }
/* use Qt dash feature */
QVector<qreal> dashes;
gc->pen->setWidth(w);
@@ -148,6 +152,13 @@ gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *das
{
dashes << dash_list[a];
}
+ /* Qt requires the pattern to have even element count. Add the last
+ * element twice if n doesn't divide by two
+ */
+ if((n % 2) != 0)
+ {
+ dashes << dash_list[n-1];
+ }
gc->pen->setDashPattern(dashes);
}