forked from organicmaps/organicmaps
fixes according to code review.
This commit is contained in:
parent
22e5890860
commit
63f32ba2b1
3 changed files with 26 additions and 20 deletions
|
@ -52,19 +52,13 @@ namespace graphics
|
|||
|
||||
TextureRef tref(texture.get());
|
||||
|
||||
if (texture && (m_textures.find(tref) == m_textures.end()))
|
||||
{
|
||||
m_textures.insert(tref);
|
||||
if (texture && m_textures.insert(tref).second)
|
||||
m_parent->addTextureRef(tref);
|
||||
}
|
||||
|
||||
StorageRef sref(storage.m_vertices.get(), storage.m_indices.get());
|
||||
|
||||
if (storage.isValid() && (m_storages.find(sref) == m_storages.end()))
|
||||
{
|
||||
m_storages.insert(sref);
|
||||
if (storage.isValid() && m_storages.insert(sref).second)
|
||||
m_parent->addStorageRef(sref);
|
||||
}
|
||||
|
||||
m_commands.push_back(cmd);
|
||||
}
|
||||
|
|
|
@ -17,22 +17,28 @@ namespace graphics
|
|||
|
||||
void DisplayListRenderer::removeStorageRef(StorageRef const & storage)
|
||||
{
|
||||
CHECK(m_discardStorageCmds.find(storage) != m_discardStorageCmds.end(), ());
|
||||
pair<int, shared_ptr<DiscardStorageCmd> > & dval = m_discardStorageCmds[storage];
|
||||
DelayedDiscardStorageMap::iterator dit = m_discardStorageCmds.find(storage);
|
||||
ASSERT(dit != m_discardStorageCmds.end(), ());
|
||||
|
||||
pair<int, shared_ptr<DiscardStorageCmd> > & dval = dit->second;
|
||||
--dval.first;
|
||||
|
||||
if ((dval.first == 0) && dval.second)
|
||||
{
|
||||
dval.second->perform();
|
||||
dval.second.reset();
|
||||
m_discardStorageCmds.erase(dit);
|
||||
}
|
||||
|
||||
CHECK(m_freeStorageCmds.find(storage) != m_freeStorageCmds.end(), ());
|
||||
pair<int, shared_ptr<FreeStorageCmd> > & fval = m_freeStorageCmds[storage];
|
||||
DelayedFreeStorageMap::iterator fit = m_freeStorageCmds.find(storage);
|
||||
ASSERT(fit != m_freeStorageCmds.end(), ());
|
||||
|
||||
pair<int, shared_ptr<FreeStorageCmd> > & fval = fit->second;
|
||||
--fval.first;
|
||||
|
||||
if ((fval.first == 0) && fval.second)
|
||||
{
|
||||
fval.second->perform();
|
||||
fval.second.reset();
|
||||
m_freeStorageCmds.erase(fit);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,14 +50,16 @@ namespace graphics
|
|||
|
||||
void DisplayListRenderer::removeTextureRef(TextureRef const & texture)
|
||||
{
|
||||
CHECK(m_freeTextureCmds.find(texture) != m_freeTextureCmds.end(), ());
|
||||
pair<int, shared_ptr<FreeTextureCmd> > & val = m_freeTextureCmds[texture];
|
||||
DelayedFreeTextureMap::iterator tit = m_freeTextureCmds.find(texture);
|
||||
ASSERT(tit != m_freeTextureCmds.end(), ());
|
||||
|
||||
pair<int, shared_ptr<FreeTextureCmd> > & val = tit->second;
|
||||
--val.first;
|
||||
|
||||
if ((val.first == 0) && val.second)
|
||||
{
|
||||
val.second->perform();
|
||||
val.second.reset();
|
||||
m_freeTextureCmds.erase(tit);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,9 +28,13 @@ namespace graphics
|
|||
typedef gl::BaseTexture const * TextureRef;
|
||||
typedef pair<gl::BufferObject const *, gl::BufferObject const *> StorageRef;
|
||||
|
||||
map<TextureRef, pair<int, shared_ptr<FreeTextureCmd> > > m_freeTextureCmds;
|
||||
map<StorageRef, pair<int, shared_ptr<FreeStorageCmd> > > m_freeStorageCmds;
|
||||
map<StorageRef, pair<int, shared_ptr<DiscardStorageCmd> > > m_discardStorageCmds;
|
||||
typedef map<TextureRef, pair<int, shared_ptr<FreeTextureCmd> > > DelayedFreeTextureMap;
|
||||
typedef map<StorageRef, pair<int, shared_ptr<FreeStorageCmd> > > DelayedFreeStorageMap;
|
||||
typedef map<StorageRef, pair<int, shared_ptr<DiscardStorageCmd> > > DelayedDiscardStorageMap;
|
||||
|
||||
DelayedFreeTextureMap m_freeTextureCmds;
|
||||
DelayedFreeStorageMap m_freeStorageCmds;
|
||||
DelayedDiscardStorageMap m_discardStorageCmds;
|
||||
|
||||
void addStorageRef(StorageRef const & storage);
|
||||
void removeStorageRef(StorageRef const & storage);
|
||||
|
|
Loading…
Add table
Reference in a new issue