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. */
SpriteData sd;
memset(&sd, 0, sizeof(sd));
SpriteData sd{};
uint all_sprites_size = 0;
for (ZoomLevel z = zoom_min; z <= zoom_max; z++) {
const SpriteLoader::Sprite *src_sprite = &sprite[z];

View File

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