(svn r15556) -Change: don't temporary malloc+free when encoding sprites, just reuse the same piece of allocated memory for each encoding.

This commit is contained in:
rubidium
2009-02-23 17:54:02 +00:00
parent 0c1b8ea602
commit 3ba802e995
4 changed files with 66 additions and 23 deletions

View File

@@ -560,17 +560,4 @@ void GfxInitSpriteMem()
_compact_cache_counter = 0;
}
void SpriteLoader::Sprite::AllocateData(size_t size)
{
if (Sprite::size < size) {
Sprite::size = size;
Sprite::mem = ReallocT<SpriteLoader::CommonPixel>(Sprite::mem, Sprite::size);
}
memset(Sprite::mem, 0, sizeof(SpriteLoader::CommonPixel) * size);
this->data = Sprite::mem;
}
/* static */ SpriteLoader::CommonPixel *SpriteLoader::Sprite::mem = NULL;
/* static */ size_t SpriteLoader::Sprite::size = 0;
/* static */ ReusableBuffer<SpriteLoader::CommonPixel> SpriteLoader::Sprite::buffer;