1
0
Fork 0

Codechange: Use default initialisation for 32bpp_sse2's SpriteData.

Avoids using memset.
pull/13881/head
Peter Nelson 2025-03-23 16:35:36 +00:00 committed by Peter Nelson
parent 828e808444
commit 5abe7c1386
2 changed files with 7 additions and 8 deletions

View File

@ -35,8 +35,7 @@ Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::SpriteCollection &spri
} }
/* Calculate sizes and allocate. */ /* Calculate sizes and allocate. */
SpriteData sd; SpriteData sd{};
memset(&sd, 0, sizeof(sd));
uint all_sprites_size = 0; uint all_sprites_size = 0;
for (ZoomLevel z = zoom_min; z <= zoom_max; z++) { for (ZoomLevel z = zoom_min; z <= zoom_max; z++) {
const SpriteLoader::Sprite *src_sprite = &sprite[z]; const SpriteLoader::Sprite *src_sprite = &sprite[z];

View File

@ -65,14 +65,14 @@ public:
/** Data stored about a (single) sprite. */ /** Data stored about a (single) sprite. */
struct SpriteInfo { struct SpriteInfo {
uint32_t sprite_offset; ///< The offset to the sprite data. uint32_t sprite_offset = 0; ///< The offset to the sprite data.
uint32_t mv_offset; ///< The offset to the map value data. uint32_t mv_offset = 0; ///< The offset to the map value data.
uint16_t sprite_line_size; ///< The size of a single line (pitch). uint16_t sprite_line_size = 0; ///< The size of a single line (pitch).
uint16_t sprite_width; ///< The width of the sprite. uint16_t sprite_width = 0; ///< The width of the sprite.
}; };
struct SpriteData { struct SpriteData {
SpriteFlags flags; SpriteFlags flags{};
SpriteInfo infos[ZOOM_LVL_END]; std::array<SpriteInfo, ZOOM_LVL_END> infos{};
uint8_t data[]; ///< Data, all zoomlevels. uint8_t data[]; ///< Data, all zoomlevels.
}; };