Fix:gtk: Check if text is out of screen and skip rendering
authorzaxl <zaxl@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 17 Nov 2008 00:13:53 +0000 (00:13 +0000)
committerzaxl <zaxl@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Mon, 17 Nov 2008 00:13:53 +0000 (00:13 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@1732 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c

index 595508f..b72fce1 100644 (file)
@@ -324,6 +324,16 @@ draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics
 
        if (! font)
                return;
+       /* 
+        This needs an improvement, no one checks if the strings are visible
+       */
+       if (p->x > gr->width-50 || p->y > gr->height-50) {
+               return;
+       }
+       if (p->x < -50 || p->y < -50) {
+               return;
+       }
+
        if (bg) {
                if (bg->level > 32767) {
                        gdk_gc_set_function(fg->gc, GDK_AND_INVERT);