use map instead of unavailable unordered_map, in case of boost 1.35
This commit is contained in:
parent
701bcc2144
commit
e92f75c8a1
1 changed files with 21 additions and 1 deletions
|
@ -29,7 +29,13 @@
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
#include <boost/utility.hpp>
|
#include <boost/utility.hpp>
|
||||||
#include <boost/unordered_map.hpp>
|
|
||||||
|
// map vs hashmap
|
||||||
|
#if BOOST_VERSION < 103600
|
||||||
|
#include <map>
|
||||||
|
#else
|
||||||
|
#include <boost/unordered_map.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -52,6 +58,16 @@ namespace mapnik {
|
||||||
{
|
{
|
||||||
return r==y.r && g==y.g && b==y.b && a==y.a;
|
return r==y.r && g==y.g && b==y.b && a==y.a;
|
||||||
}
|
}
|
||||||
|
int operator<(const rgba& y) const
|
||||||
|
{
|
||||||
|
if (r!=y.r)
|
||||||
|
return r<y.r;
|
||||||
|
if (g!=y.g)
|
||||||
|
return g<y.g;
|
||||||
|
if (b!=y.b)
|
||||||
|
return b<y.b;
|
||||||
|
return a<y.a;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define HASH_RGBA(p) (((std::size_t)p.r * 33023 + (std::size_t)p.g * 30013 + (std::size_t)p.b * 27011 + (std::size_t)p.a * 24007) % 21001)
|
#define HASH_RGBA(p) (((std::size_t)p.r * 33023 + (std::size_t)p.g * 30013 + (std::size_t)p.b * 27011 + (std::size_t)p.a * 24007) % 21001)
|
||||||
|
@ -157,7 +173,11 @@ namespace mapnik {
|
||||||
// index remaping of sorted_pal_ indexes to indexes of returned image palette
|
// index remaping of sorted_pal_ indexes to indexes of returned image palette
|
||||||
std::vector<unsigned> pal_remap_;
|
std::vector<unsigned> pal_remap_;
|
||||||
// rgba hashtable for quantization
|
// rgba hashtable for quantization
|
||||||
|
#if BOOST_VERSION < 103600
|
||||||
|
typedef std::map<rgba, int> rgba_hash_table;
|
||||||
|
#else
|
||||||
typedef boost::unordered_map<rgba, int, rgba_hash_func> rgba_hash_table;
|
typedef boost::unordered_map<rgba, int, rgba_hash_func> rgba_hash_table;
|
||||||
|
#endif
|
||||||
rgba_hash_table color_hashmap_;
|
rgba_hash_table color_hashmap_;
|
||||||
// gamma correction to prioritize dark colors (>1.0)
|
// gamma correction to prioritize dark colors (>1.0)
|
||||||
double gamma_;
|
double gamma_;
|
||||||
|
|
Loading…
Reference in a new issue