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:
@@ -109,20 +109,20 @@ void Blitter_32bppSimple::DrawColourMappingRect(void *dst, int width, int height
|
||||
Debug(misc, 0, "32bpp blitter doesn't know how to draw this colour table ('{}')", pal);
|
||||
}
|
||||
|
||||
Sprite *Blitter_32bppSimple::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||
Sprite *Blitter_32bppSimple::Encode(const SpriteLoader::SpriteCollection &sprite, AllocatorProc *allocator)
|
||||
{
|
||||
Blitter_32bppSimple::Pixel *dst;
|
||||
Sprite *dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + (size_t)sprite->height * (size_t)sprite->width * sizeof(*dst));
|
||||
Sprite *dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + (size_t)sprite[ZOOM_LVL_NORMAL].height * (size_t)sprite[ZOOM_LVL_NORMAL].width * sizeof(*dst));
|
||||
|
||||
dest_sprite->height = sprite->height;
|
||||
dest_sprite->width = sprite->width;
|
||||
dest_sprite->x_offs = sprite->x_offs;
|
||||
dest_sprite->y_offs = sprite->y_offs;
|
||||
dest_sprite->height = sprite[ZOOM_LVL_NORMAL].height;
|
||||
dest_sprite->width = sprite[ZOOM_LVL_NORMAL].width;
|
||||
dest_sprite->x_offs = sprite[ZOOM_LVL_NORMAL].x_offs;
|
||||
dest_sprite->y_offs = sprite[ZOOM_LVL_NORMAL].y_offs;
|
||||
|
||||
dst = (Blitter_32bppSimple::Pixel *)dest_sprite->data;
|
||||
SpriteLoader::CommonPixel *src = (SpriteLoader::CommonPixel *)sprite->data;
|
||||
SpriteLoader::CommonPixel *src = (SpriteLoader::CommonPixel *)sprite[ZOOM_LVL_NORMAL].data;
|
||||
|
||||
for (int i = 0; i < sprite->height * sprite->width; i++) {
|
||||
for (int i = 0; i < sprite[ZOOM_LVL_NORMAL].height * sprite[ZOOM_LVL_NORMAL].width; i++) {
|
||||
if (src->m == 0) {
|
||||
dst[i].r = src->r;
|
||||
dst[i].g = src->g;
|
||||
|
Reference in New Issue
Block a user