switch glyph_info cache to an unordered_map (but no perf diff on osx)

This commit is contained in:
Dane Springmeyer 2014-08-05 14:31:29 -07:00
parent 9efed3edaf
commit 7a013e8151
2 changed files with 4 additions and 3 deletions

View file

@ -36,7 +36,7 @@ extern "C"
}
//stl
#include <map>
#include <unordered_map>
#include <memory>
#include <string>
#include <vector>
@ -47,6 +47,7 @@ namespace mapnik
class font_face : mapnik::noncopyable
{
public:
using glyph_info_cache_type = std::unordered_map<glyph_index_t, glyph_info>;
font_face(FT_Face face);
std::string family_name() const
@ -75,7 +76,7 @@ public:
private:
FT_Face face_;
mutable std::map<glyph_index_t, glyph_info> glyph_info_cache_;
mutable glyph_info_cache_type glyph_info_cache_;
mutable double char_height_;
};
using face_ptr = std::shared_ptr<font_face>;

View file

@ -64,7 +64,7 @@ bool font_face::set_unscaled_character_sizes()
bool font_face::glyph_dimensions(glyph_info & glyph) const
{
// Check if glyph is already in cache
std::map<glyph_index_t, glyph_info>::const_iterator itr;
glyph_info_cache_type::const_iterator itr;
itr = glyph_info_cache_.find(glyph.glyph_index);
if (itr != glyph_info_cache_.end()) {
glyph = itr->second;