| 43 | } |
| 44 | |
| 45 | bool TexPool::Add(Plugin *plugin, IDParam const& id, bool allowReplace) |
| 46 | { |
| 47 | if (!m_alive) |
| 48 | { |
| 49 | return false; |
| 50 | } |
| 51 | |
| 52 | if (!allowReplace) |
| 53 | { |
| 54 | if (Exist(id)) |
| 55 | { |
| 56 | return false; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | intrusive_ptr<graph::Surface> tex = plugin->GetTexture(id); |
| 61 | if (tex.get()) |
| 62 | { |
| 63 | m_storMtx->Lock(); |
| 64 | RemoveForReplace(id); |
| 65 | m_stor[id.GetIDHash()] = tex; |
| 66 | m_storMtx->Unlock(); |
| 67 | return true; |
| 68 | } |
| 69 | |
| 70 | Remove(id); |
| 71 | |
| 72 | return false; |
| 73 | } |
| 74 | |
| 75 | bool TexPool::Add(IDParam const& id, uint8_t *buffer, size_t bufferSize, bool allowReplace) |
| 76 | { |