From 6737bd959fcacdb2b81819ecebb78502aa390f31 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 23 Feb 2012 15:58:23 -0800 Subject: [PATCH] backport hextree sorting fix to 0.7.x series - refs #1087 --- include/mapnik/hextree.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/mapnik/hextree.hpp b/include/mapnik/hextree.hpp index 064371fa6..fa7fd20c1 100644 --- a/include/mapnik/hextree.hpp +++ b/include/mapnik/hextree.hpp @@ -156,10 +156,11 @@ namespace mapnik { if (t1!=t2) return t1> 24) + - (((int)x.r-y.r) >> 16) + - (((int)x.g-y.g) >> 8) + - ((int)x.b-y.b); + // https://github.com/mapnik/mapnik/issues/1087 + if (x.a != y.a) return x.a < y.a; + if (x.r != y.r) return x.r < y.r; + if (x.g != y.g) return x.g < y.g; + return x.b < y.b; } }; @@ -491,7 +492,7 @@ namespace mapnik { } tries=0; // 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) { colors_--;