ensure mean_sort_cmp adheres to strict weak ordering requirement - more properly fixes #1087
This commit is contained in:
parent
188ba774b9
commit
4a192c319b
1 changed files with 5 additions and 4 deletions
|
@ -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;
|
int t2 = (int)y.a + y.r + y.g + y.b;
|
||||||
if (t1 != t2) return t1 < t2;
|
if (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;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t rgba::hash_func::operator()(rgba const& p) const
|
std::size_t rgba::hash_func::operator()(rgba const& p) const
|
||||||
|
|
Loading…
Reference in a new issue