[grits] Fix queue_draw on grits_tiles



commit 6793e7a7f7752e8924c40c0e0c99e857350d7356
Author: Andy Spencer <andy753421 gmail com>
Date:   Wed Jan 23 06:29:46 2013 +0000

    Fix queue_draw on grits_tiles
    
    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 |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/objects/grits-tile.c b/src/objects/grits-tile.c
index e42a160..7d656e5 100644
--- a/src/objects/grits-tile.c
+++ b/src/objects/grits-tile.c
@@ -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;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]