Skip to content

Commit 0b27a70

Browse files
committedOct 12, 2016
Don't use unordered maps for ProfilerGraph (fixes flickering)
1 parent 4f684b5 commit 0b27a70

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
 

Diff for: ‎src/game.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,9 @@ class ProfilerGraph
605605
void draw(s32 x_left, s32 y_bottom, video::IVideoDriver *driver,
606606
gui::IGUIFont *font) const
607607
{
608-
UNORDERED_MAP<std::string, Meta> m_meta;
608+
// Do *not* use UNORDERED_MAP here as the order needs
609+
// to be the same for each call to prevent flickering
610+
std::map<std::string, Meta> m_meta;
609611

610612
for (std::deque<Piece>::const_iterator k = m_log.begin();
611613
k != m_log.end(); ++k) {
@@ -615,7 +617,7 @@ class ProfilerGraph
615617
i != piece.values.end(); ++i) {
616618
const std::string &id = i->first;
617619
const float &value = i->second;
618-
UNORDERED_MAP<std::string, Meta>::iterator j = m_meta.find(id);
620+
std::map<std::string, Meta>::iterator j = m_meta.find(id);
619621

620622
if (j == m_meta.end()) {
621623
m_meta[id] = Meta(value);
@@ -642,7 +644,7 @@ class ProfilerGraph
642644
sizeof(usable_colors) / sizeof(*usable_colors);
643645
u32 next_color_i = 0;
644646

645-
for (UNORDERED_MAP<std::string, Meta>::iterator i = m_meta.begin();
647+
for (std::map<std::string, Meta>::iterator i = m_meta.begin();
646648
i != m_meta.end(); ++i) {
647649
Meta &meta = i->second;
648650
video::SColor color(255, 200, 200, 200);
@@ -658,7 +660,7 @@ class ProfilerGraph
658660
s32 textx2 = textx + 200 - 15;
659661
s32 meta_i = 0;
660662

661-
for (UNORDERED_MAP<std::string, Meta>::const_iterator i = m_meta.begin();
663+
for (std::map<std::string, Meta>::const_iterator i = m_meta.begin();
662664
i != m_meta.end(); ++i) {
663665
const std::string &id = i->first;
664666
const Meta &meta = i->second;

0 commit comments

Comments
 (0)
Please sign in to comment.