Welcome to mirror list, hosted at ThFree Co, Russian Federation.

tile_cache.cpp « map - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 802fc3d93fd0db520400eb560687826996c86f6e (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#include "tile_cache.hpp"

void TileCache::EntryValueTraits::Evict(Entry &val)
{
  if (val.m_rm)
    val.m_rm->texturePool(graphics::ERenderTargetTexture)->Free(val.m_tile.m_renderTarget);
}

TileCache::Entry::Entry()
{}

TileCache::Entry::Entry(Tile const & tile, shared_ptr<graphics::ResourceManager> const & rm)
  : m_tile(tile), m_rm(rm)
{}

TileCache::TileCache()
{}

void TileCache::AddTile(Tiler::RectInfo const & key, Entry const & entry)
{
  m_cache.Add(key, entry, 1);
}

void TileCache::Lock()
{
  m_lock.Lock();
}

void TileCache::Unlock()
{
  m_lock.Unlock();
}

set<Tiler::RectInfo> const & TileCache::Keys() const
{
  return m_cache.Keys();
/*  set<uint64_t> keys = m_cache.Keys();
  set<Tiler::RectInfo> rects;

  for (set<uint64_t>::const_iterator it = keys.begin(); it != keys.end(); ++it)
  {
    Tiler::RectInfo v;
    v.fromUInt64Cell(*it);
    rects.insert(v);
  }

  return rects;*/
}

bool TileCache::HasTile(Tiler::RectInfo const & key)
{
  return m_cache.HasElem(key);
}

void TileCache::LockTile(Tiler::RectInfo const & key)
{
  m_cache.LockElem(key);
}

size_t TileCache::LockCount(Tiler::RectInfo const & key)
{
  return m_cache.LockCount(key);
}

void TileCache::UnlockTile(Tiler::RectInfo const & key)
{
  m_cache.UnlockElem(key);
}

void TileCache::TouchTile(Tiler::RectInfo const & key)
{
  m_cache.Touch(key);
}

Tile const & TileCache::GetTile(Tiler::RectInfo const & key)
{
  return m_cache.Find(key).m_tile;
}

void TileCache::Remove(Tiler::RectInfo const & key)
{
  m_cache.Remove(key);
}

int TileCache::CanFit() const
{
  return m_cache.CanFit();
}

int TileCache::UnlockedWeight() const
{
  return m_cache.UnlockedWeight();
}

int TileCache::LockedWeight() const
{
  return m_cache.LockedWeight();
}

int TileCache::CacheSize() const
{
  return m_cache.MaxWeight();
}

void TileCache::Resize(int maxWeight)
{
  m_cache.Resize(maxWeight);
}

void TileCache::FreeRoom(int weight)
{
  m_cache.FreeRoom(weight);
}