blob: 8994f8c907fa7e8127319b7f21d3afe1febcf663 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#pragma once
#include "base/math.hpp"
#include "graphics/defines.hpp"
#include "std/map.hpp"
namespace graphics
{
class Screen;
class DisplayList;
}
class UserMarkDLCache
{
public:
struct Key
{
Key(string const & name, graphics::EPosition anchor, double depthLayer)
: m_name(name), m_anchor(anchor), m_depthLayer(depthLayer) {}
string m_name;
graphics::EPosition m_anchor;
double m_depthLayer;
bool operator < (Key const & other) const
{
if (m_name != other.m_name)
return m_name < other.m_name;
if (!my::AlmostEqualULPs(m_depthLayer, other.m_depthLayer))
return m_depthLayer < other.m_depthLayer;
return m_anchor < other.m_anchor;
}
};
UserMarkDLCache(graphics::Screen * cacheScreen);
~UserMarkDLCache();
graphics::DisplayList * FindUserMark(Key const & key);
private:
graphics::DisplayList * CreateDL(Key const & key);
private:
graphics::Screen * m_cacheScreen;
typedef map<Key, graphics::DisplayList *> cache_t;
typedef cache_t::iterator node_t;
cache_t m_dls;
};
|