From 27b837a6b4de2af4b749d2d859d3467b97e2dbf4 Mon Sep 17 00:00:00 2001 From: Andy Spencer Date: Sat, 11 Feb 2012 07:03:17 +0000 Subject: [PATCH] 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 file 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, -- 2.43.2