[grits] Check for split on all child tiles



commit 27b837a6b4de2af4b749d2d859d3467b97e2dbf4
Author: Andy Spencer <andy753421 gmail com>
Date:   Sat Feb 11 07:03:17 2012 +0000

    Check for split on all child tiles
    
    When tiles split, all the children will be valid so only [0][0] needs to
    be checked. However, a child tile may be garbage collected in which case
    there may be a NULL child tile.

 src/objects/grits-tile.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/objects/grits-tile.c b/src/objects/grits-tile.c
index 736e374..75ce3a0 100644
--- a/src/objects/grits-tile.c
+++ b/src/objects/grits-tile.c
@@ -215,14 +215,17 @@ void grits_tile_update(GritsTile *tile, GritsPoint *eye,
 		return;
 	}
 
-	/* Need more resolution, split tile and update recursively */
-	if (!tile->children[0][0]) {
-		switch (tile->proj) {
-		case GRITS_PROJ_LATLON:   _grits_tile_split_latlon(tile);   break;
-		case GRITS_PROJ_MERCATOR: _grits_tile_split_mercator(tile); break;
+	/* Split tile if needed */
+	grits_tile_foreach(tile, child) {
+		if (child == NULL) {
+			switch (tile->proj) {
+			case GRITS_PROJ_LATLON:   _grits_tile_split_latlon(tile);   break;
+			case GRITS_PROJ_MERCATOR: _grits_tile_split_mercator(tile); break;
+			}
 		}
 	}
 
+	/* Update recursively */
 	grits_tile_foreach(tile, child) {
 		GRITS_OBJECT(child)->hidden = FALSE;
 		grits_tile_update(child, eye, res, width, height,



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