Smart tile cache with LRU eviction for efficient memory management. More...
#include <tilemap.h>
Public Member Functions | |
Bitmap * | GetTile (int tile_id) |
Get a cached tile by ID. | |
void | CacheTile (int tile_id, Bitmap &&bitmap) |
Cache a tile bitmap. | |
void | Clear () |
Clear the cache. | |
size_t | Size () const |
Get cache statistics. | |
Public Attributes | |
std::unordered_map< int, Bitmap > | cache_ |
std::list< int > | access_order_ |
Static Public Attributes | |
static constexpr size_t | MAX_CACHE_SIZE = 1024 |
Smart tile cache with LRU eviction for efficient memory management.
Performance Optimizations:
|
inline |
Get a cached tile by ID.
tile_id | Tile identifier |
Definition at line 42 of file tilemap.h.
References access_order_, and cache_.
Referenced by yaze::editor::ScreenEditor::DrawDungeonMapScreen(), yaze::editor::ScreenEditor::DrawDungeonMapsRoomGfx(), yaze::gfx::RenderTilesBatch(), and yaze::gfx::UpdateTile16().
|
inline |
Cache a tile bitmap.
tile_id | Tile identifier |
bitmap | Tile bitmap to cache |
Definition at line 58 of file tilemap.h.
References access_order_, cache_, and MAX_CACHE_SIZE.
Referenced by yaze::gfx::RenderTilesBatch().
|
inline |
|
inline |
|
staticconstexpr |
Definition at line 33 of file tilemap.h.
Referenced by CacheTile().
std::unordered_map<int, Bitmap> yaze::gfx::TileCache::cache_ |
std::list<int> yaze::gfx::TileCache::access_order_ |
Definition at line 35 of file tilemap.h.
Referenced by CacheTile(), Clear(), and GetTile().