src/spritecache.cpp
changeset 9237 9f210581c3a9
parent 9058 b9c3fec968b8
child 10429 1b99254f9607
equal deleted inserted replaced
9236:9ea37e1b43ce 9237:9f210581c3a9
    21 /* Default of 4MB spritecache */
    21 /* Default of 4MB spritecache */
    22 uint _sprite_cache_size = 4;
    22 uint _sprite_cache_size = 4;
    23 
    23 
    24 
    24 
    25 struct SpriteCache {
    25 struct SpriteCache {
    26  	void *ptr;
    26 	void *ptr;
    27 	uint32 id;
    27 	uint32 id;
    28  	uint32 file_pos;
    28 	uint32 file_pos;
    29 	uint16 file_slot;
    29 	uint16 file_slot;
    30  	int16 lru;
    30 	int16 lru;
    31 };
    31 };
    32 
    32 
    33 
    33 
    34 static uint _spritecache_items = 0;
    34 static uint _spritecache_items = 0;
    35 static SpriteCache *_spritecache = NULL;
    35 static SpriteCache *_spritecache = NULL;
   336 
   336 
   337 			/* Since free blocks are automatically coalesced, this should hold true. */
   337 			/* Since free blocks are automatically coalesced, this should hold true. */
   338 			assert(!(next->size & S_FREE_MASK));
   338 			assert(!(next->size & S_FREE_MASK));
   339 
   339 
   340 			/* If the next block is the sentinel block, we can safely return */
   340 			/* If the next block is the sentinel block, we can safely return */
   341 			if (next->size == 0)
   341 			if (next->size == 0) break;
   342 				break;
       
   343 
   342 
   344 			/* Locate the sprite belonging to the next pointer. */
   343 			/* Locate the sprite belonging to the next pointer. */
   345 			for (i = 0; GetSpriteCache(i)->ptr != next->data; i++) {
   344 			for (i = 0; GetSpriteCache(i)->ptr != next->data; i++) {
   346 				assert(i != _spritecache_items);
   345 				assert(i != _spritecache_items);
   347 			}
   346 			}