Fix queue_draw on grits_tiles
authorAndy Spencer <andy753421@gmail.com>
Wed, 23 Jan 2013 06:29:46 +0000 (06:29 +0000)
committerAndy Spencer <andy753421@gmail.com>
Wed, 23 Jan 2013 06:29:46 +0000 (06:29 +0000)
Any tile other than the top level tile wouldn't queue draw correctly
because it didn't have direct access to the viewer. Just search up until
we find it..

src/objects/grits-tile.c

index e42a160..7d656e5 100644 (file)
@@ -246,6 +246,13 @@ void grits_tile_update(GritsTile *tile, GritsPoint *eye,
                                load_func, user_data);
 }
 
+static void _grits_tile_queue_draw(GritsTile *tile)
+{
+       while (!GRITS_OBJECT(tile)->viewer && tile->parent)
+               tile = tile->parent;
+       grits_object_queue_draw(GRITS_OBJECT(tile));
+}
+
 /**
  * grits_tile_load_pixels:
  * @tile:   the tile to load data into
@@ -276,7 +283,8 @@ gboolean grits_tile_load_pixels(GritsTile *tile, guchar *pixels,
        tile->pixels = pixels;
 
        /* Queue OpenGL texture load/draw */
-       grits_object_queue_draw(GRITS_OBJECT(tile));
+       _grits_tile_queue_draw(tile);
+
        return TRUE;
 }
 
@@ -301,7 +309,7 @@ gboolean grits_tile_load_pixbuf(GritsTile *tile, GdkPixbuf *pixbuf)
        tile->alpha  = gdk_pixbuf_get_has_alpha(pixbuf);
 
        /* Queue OpenGL texture load/draw */
-       grits_object_queue_draw(GRITS_OBJECT(tile));
+       _grits_tile_queue_draw(tile);
 
        return TRUE;
 }
@@ -329,7 +337,7 @@ gboolean grits_tile_load_file(GritsTile *tile, const gchar *file)
        tile->alpha  = gdk_pixbuf_get_has_alpha(tile->pixbuf);
 
        /* Queue OpenGL texture load/draw */
-       grits_object_queue_draw(GRITS_OBJECT(tile));
+       _grits_tile_queue_draw(tile);
 
        return TRUE;
 }