switch glyph_info cache to an unordered_map (but no perf diff on osx)
This commit is contained in:
parent
9efed3edaf
commit
7a013e8151
2 changed files with 4 additions and 3 deletions
|
@ -36,7 +36,7 @@ extern "C"
|
||||||
}
|
}
|
||||||
|
|
||||||
//stl
|
//stl
|
||||||
#include <map>
|
#include <unordered_map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -47,6 +47,7 @@ namespace mapnik
|
||||||
class font_face : mapnik::noncopyable
|
class font_face : mapnik::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
using glyph_info_cache_type = std::unordered_map<glyph_index_t, glyph_info>;
|
||||||
font_face(FT_Face face);
|
font_face(FT_Face face);
|
||||||
|
|
||||||
std::string family_name() const
|
std::string family_name() const
|
||||||
|
@ -75,7 +76,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FT_Face face_;
|
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_;
|
mutable double char_height_;
|
||||||
};
|
};
|
||||||
using face_ptr = std::shared_ptr<font_face>;
|
using face_ptr = std::shared_ptr<font_face>;
|
||||||
|
|
|
@ -64,7 +64,7 @@ bool font_face::set_unscaled_character_sizes()
|
||||||
bool font_face::glyph_dimensions(glyph_info & glyph) const
|
bool font_face::glyph_dimensions(glyph_info & glyph) const
|
||||||
{
|
{
|
||||||
// Check if glyph is already in cache
|
// 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);
|
itr = glyph_info_cache_.find(glyph.glyph_index);
|
||||||
if (itr != glyph_info_cache_.end()) {
|
if (itr != glyph_info_cache_.end()) {
|
||||||
glyph = itr->second;
|
glyph = itr->second;
|
||||||
|
|
Loading…
Reference in a new issue