Codechange: Replace AllocatorProc with SpriteAllocator class.

This allows for state to be passed to or maintained by the allocator.
This commit is contained in:
2024-05-12 11:23:22 +01:00
committed by Peter Nelson
parent de16655f76
commit 7b717fcccb
26 changed files with 93 additions and 54 deletions

View File

@@ -31,10 +31,13 @@ enum SpriteCacheCtrlFlags {
extern uint _sprite_cache_size;
typedef void *AllocatorProc(size_t size);
/** SpriteAllocate that uses malloc to allocate memory. */
class SimpleSpriteAllocator : public SpriteAllocator {
protected:
void *AllocatePtr(size_t size) override;
};
void *SimpleSpriteAlloc(size_t size);
void *GetRawSprite(SpriteID sprite, SpriteType type, AllocatorProc *allocator = nullptr, SpriteEncoder *encoder = nullptr);
void *GetRawSprite(SpriteID sprite, SpriteType type, SpriteAllocator *allocator = nullptr, SpriteEncoder *encoder = nullptr);
bool SpriteExists(SpriteID sprite);
SpriteType GetSpriteType(SpriteID sprite);