OpenTTD Source 20250511-master-gf2b48bad79
SpriteLoader::Sprite Struct Reference

Structure for passing information from the sprite loader to the blitter. More...

#include <spriteloader.hpp>

Public Member Functions

void AllocateData (ZoomLevel zoom, size_t size)
 Allocate the sprite data of this sprite.
 

Data Fields

uint16_t height
 Height of the sprite.
 
uint16_t width
 Width of the sprite.
 
int16_t x_offs
 The x-offset of where the sprite will be drawn.
 
int16_t y_offs
 The y-offset of where the sprite will be drawn.
 
SpriteComponents colours
 The colour components of the sprite with useful information.
 
SpriteLoader::CommonPixeldata
 The sprite itself.
 

Static Private Attributes

static SpriteCollMap< ReusableBuffer< SpriteLoader::CommonPixel > > buffer
 Allocated memory to pass sprite data around.
 

Detailed Description

Structure for passing information from the sprite loader to the blitter.

You can only use this struct once at a time when using AllocateData to allocate the memory as that will always return the same memory address. This to prevent thousands of malloc + frees just to load a sprite.

Definition at line 61 of file spriteloader.hpp.

Member Function Documentation

◆ AllocateData()

void SpriteLoader::Sprite::AllocateData ( ZoomLevel  zoom,
size_t  size 
)
inline

Allocate the sprite data of this sprite.

Parameters
zoomZoom level to allocate the data for.
sizethe minimum size of the data field.

Definition at line 74 of file spriteloader.hpp.

References buffer.

Referenced by DecodeSingleSprite().

Field Documentation

◆ buffer

SpriteCollMap< ReusableBuffer< SpriteLoader::CommonPixel > > SpriteLoader::Sprite::buffer
staticprivate

Allocated memory to pass sprite data around.

Definition at line 77 of file spriteloader.hpp.

Referenced by AllocateData().

◆ colours

SpriteComponents SpriteLoader::Sprite::colours

The colour components of the sprite with useful information.

Definition at line 66 of file spriteloader.hpp.

◆ data

SpriteLoader::CommonPixel* SpriteLoader::Sprite::data

The sprite itself.

Definition at line 67 of file spriteloader.hpp.

Referenced by Convert32bppTo8bpp(), DecodeSingleSprite(), and Blitter_8bppOptimized::Encode().

◆ height

uint16_t SpriteLoader::Sprite::height

Height of the sprite.

Definition at line 62 of file spriteloader.hpp.

Referenced by Convert32bppTo8bpp(), DecodeSingleSprite(), and Blitter_8bppOptimized::Encode().

◆ width

uint16_t SpriteLoader::Sprite::width

Width of the sprite.

Definition at line 63 of file spriteloader.hpp.

Referenced by Convert32bppTo8bpp(), DecodeSingleSprite(), and Blitter_8bppOptimized::Encode().

◆ x_offs

int16_t SpriteLoader::Sprite::x_offs

The x-offset of where the sprite will be drawn.

Definition at line 64 of file spriteloader.hpp.

◆ y_offs

int16_t SpriteLoader::Sprite::y_offs

The y-offset of where the sprite will be drawn.

Definition at line 65 of file spriteloader.hpp.


The documentation for this struct was generated from the following files: