backport hextree sorting fix to 2.0.x series - refs #1087
This commit is contained in:
parent
53e171c1f1
commit
ee8a150e38
2 changed files with 6 additions and 5 deletions
|
@ -434,7 +434,7 @@ private:
|
|||
}
|
||||
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(long(cur_node->pixel_count)) > 15
|
||||
if (cur_node->pixel_count > 0 && (cur_node->reduce_cost / cur_node->pixel_count + 1) * std::log(long(cur_node->pixel_count)) > 15
|
||||
&& cur_node->children_count > 0)
|
||||
{
|
||||
colors_--;
|
||||
|
|
|
@ -35,10 +35,11 @@ bool rgba::mean_sort_cmp::operator() (const rgba& x, const rgba& y) const
|
|||
int t2 = (int)y.a + y.r + y.g + y.b;
|
||||
if (t1 != t2) return t1 < t2;
|
||||
|
||||
return (((int)x.a - y.a) >> 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;
|
||||
}
|
||||
|
||||
std::size_t rgba::hash_func::operator()(rgba const& p) const
|
||||
|
|
Loading…
Add table
Reference in a new issue