backport hextree sorting fix to 0.7.x series - refs #1087

This commit is contained in:
Dane Springmeyer 2012-02-23 15:58:23 -08:00
parent 5572514354
commit 6737bd959f

View file

@ -156,10 +156,11 @@ namespace mapnik {
if (t1!=t2) if (t1!=t2)
return t1<t2; return t1<t2;
return (((int)x.a-y.a) >> 24) + // https://github.com/mapnik/mapnik/issues/1087
(((int)x.r-y.r) >> 16) + if (x.a != y.a) return x.a < y.a;
(((int)x.g-y.g) >> 8) + if (x.r != y.r) return x.r < y.r;
((int)x.b-y.b); if (x.g != y.g) return x.g < y.g;
return x.b < y.b;
} }
}; };
@ -491,7 +492,7 @@ namespace mapnik {
} }
tries=0; tries=0;
// ignore leaves and also nodes with small mean error and not excessive number of pixels // ignore leaves and also nodes with small mean error and not excessive number of pixels
if ((cur_node->reduce_cost / cur_node->pixel_count + 1) * std::log(double(cur_node->pixel_count)) > 15 if (cur_node->pixel_count > 0 && (cur_node->reduce_cost / cur_node->pixel_count + 1) * std::log(double(cur_node->pixel_count)) > 15
&& cur_node->children_count > 0) && cur_node->children_count > 0)
{ {
colors_--; colors_--;