src/spritecache.cpp
changeset 6574 e1d1a12faaf7
parent 6573 7624f942237f
child 6719 4cc327ad39d5
child 6916 e87d54a598ea
equal deleted inserted replaced
6573:7624f942237f 6574:e1d1a12faaf7
    13 #ifndef SPRITE_CACHE_SIZE
    13 #ifndef SPRITE_CACHE_SIZE
    14 # define SPRITE_CACHE_SIZE 2*1024*1024
    14 # define SPRITE_CACHE_SIZE 2*1024*1024
    15 #endif /* SPRITE_CACHE_SIZE */
    15 #endif /* SPRITE_CACHE_SIZE */
    16 
    16 
    17 
    17 
    18 typedef struct SpriteCache {
    18 struct SpriteCache {
    19 	void *ptr;
    19 	void *ptr;
    20 	uint32 file_pos;
    20 	uint32 file_pos;
    21 	int16 lru;
    21 	int16 lru;
    22 } SpriteCache;
    22 };
    23 
    23 
    24 
    24 
    25 static uint _spritecache_items = 0;
    25 static uint _spritecache_items = 0;
    26 static SpriteCache *_spritecache = NULL;
    26 static SpriteCache *_spritecache = NULL;
    27 
    27 
    53 
    53 
    54 	return GetSpriteCache(index);
    54 	return GetSpriteCache(index);
    55 }
    55 }
    56 
    56 
    57 
    57 
    58 typedef struct MemBlock {
    58 struct MemBlock {
    59 	uint32 size;
    59 	uint32 size;
    60 	byte data[VARARRAY_SIZE];
    60 	byte data[VARARRAY_SIZE];
    61 } MemBlock;
    61 };
    62 
    62 
    63 static uint _sprite_lru_counter;
    63 static uint _sprite_lru_counter;
    64 static MemBlock *_spritecache_ptr;
    64 static MemBlock *_spritecache_ptr;
    65 static int _compact_cache_counter;
    65 static int _compact_cache_counter;
    66 
    66