handle case of empty octrees. #540

This commit is contained in:
Marcin Rudowski 2010-03-24 17:36:39 +00:00
parent 8369278662
commit 3426e7a0ac
2 changed files with 7 additions and 2 deletions

View file

@ -122,6 +122,11 @@ namespace mapnik {
~octree() { delete root_;}
unsigned colors()
{
return colors_;
}
void setMaxColors(unsigned max_colors)
{
max_colors_ = max_colors;

View file

@ -131,7 +131,7 @@ namespace mapnik {
byte index = 0;
int idx = -1;
for(int j=levels-1; j>0; j--){
if (U2ALPHA(val)>=limits[j]) {
if (U2ALPHA(val)>=limits[j] && trees[j].colors()>0) {
index = idx = trees[j].quantize(c);
break;
}
@ -177,7 +177,7 @@ namespace mapnik {
byte index = 0;
int idx=-1;
for(int j=levels-1; j>0; j--){
if (U2ALPHA(val)>=limits[j]) {
if (U2ALPHA(val)>=limits[j] && trees[j].colors()>0) {
index = idx = trees[j].quantize(c);
break;
}