OpenTTD Source 20241224-master-gee860a5c8e
SpriteAllocator Class Referenceabstract

Interface for something that can allocate memory for a sprite. More...

#include <spriteloader.hpp>

Inheritance diagram for SpriteAllocator:
CacheSpriteAllocator SimpleSpriteAllocator UniquePtrSpriteAllocator

Public Member Functions

template<typename T >
T * Allocate (size_t size)
 Allocate memory for a sprite.
 

Protected Member Functions

virtual void * AllocatePtr (size_t size)=0
 Allocate memory for a sprite.
 

Detailed Description

Interface for something that can allocate memory for a sprite.

Definition at line 88 of file spriteloader.hpp.

Member Function Documentation

◆ Allocate()

template<typename T >
T * SpriteAllocator::Allocate ( size_t  size)
inline

Allocate memory for a sprite.

Template Parameters
TType to return memory as.
Parameters
sizeSize of memory to allocate in bytes.
Returns
Pointer to allocated memory.

Definition at line 99 of file spriteloader.hpp.

References AllocatePtr().

Referenced by Blitter_32bppSimple::Encode(), Blitter_8bppOptimized::Encode(), Blitter_8bppSimple::Encode(), Blitter_Null::Encode(), OpenGLBackend::Encode(), ReadRecolourSprite(), and ReadSprite().

◆ AllocatePtr()

virtual void * SpriteAllocator::AllocatePtr ( size_t  size)
protectedpure virtual

Allocate memory for a sprite.

Parameters
sizeSize of memory to allocate.
Returns
Pointer to allocated memory.

Implemented in SimpleSpriteAllocator, UniquePtrSpriteAllocator, and CacheSpriteAllocator.

Referenced by Allocate().


The documentation for this class was generated from the following file: