Codechange: Replace pointer to Sprite array with reference to SpriteCollection. (#11580)
Add `SpriteLoader::SpriteCollection` type which is an array of `SpriteLoad::Sprite`. This removes the ambiguity of what `SpriteLoader::Sprite *` is pointing to, and cleans up mismatches using both dereference -> and array access [] for the same object.
This commit is contained in:
@@ -65,6 +65,11 @@ public:
|
||||
static ReusableBuffer<SpriteLoader::CommonPixel> buffer[ZOOM_LVL_END];
|
||||
};
|
||||
|
||||
/**
|
||||
* Type defining a collection of sprites, one for each zoom level.
|
||||
*/
|
||||
using SpriteCollection = std::array<Sprite, ZOOM_LVL_END>;
|
||||
|
||||
/**
|
||||
* Load a sprite from the disk and return a sprite struct which is the same for all loaders.
|
||||
* @param[out] sprite The sprites to fill with data.
|
||||
@@ -75,7 +80,7 @@ public:
|
||||
* @param control_flags Control flags, see SpriteCacheCtrlFlags.
|
||||
* @return Bit mask of the zoom levels successfully loaded or 0 if no sprite could be loaded.
|
||||
*/
|
||||
virtual uint8_t LoadSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t file_pos, SpriteType sprite_type, bool load_32bpp, byte control_flags) = 0;
|
||||
virtual uint8_t LoadSprite(SpriteLoader::SpriteCollection &sprite, SpriteFile &file, size_t file_pos, SpriteType sprite_type, bool load_32bpp, byte control_flags) = 0;
|
||||
|
||||
virtual ~SpriteLoader() = default;
|
||||
};
|
||||
@@ -94,7 +99,7 @@ public:
|
||||
/**
|
||||
* Convert a sprite from the loader to our own format.
|
||||
*/
|
||||
virtual Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) = 0;
|
||||
virtual Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, AllocatorProc *allocator) = 0;
|
||||
|
||||
/**
|
||||
* Get the value which the height and width on a sprite have to be aligned by.
|
||||
|
||||
Reference in New Issue
Block a user