]> Pileus Git - grits/commitdiff
Check for split on all child tiles
authorAndy Spencer <andy753421@gmail.com>
Sat, 11 Feb 2012 07:03:17 +0000 (07:03 +0000)
committerAndy Spencer <andy753421@gmail.com>
Sun, 12 Feb 2012 07:00:20 +0000 (07:00 +0000)
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

index 736e374df12812826bb053e30357994c72fe1267..75ce3a02ff5201f4d51778bc2754437c8b09d139 100644 (file)
@@ -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,