1
0
Fork 0

Codechange: Use std::byte for generic buffers.

pull/14198/head
frosch 2025-05-03 17:41:51 +02:00 committed by frosch
parent 02082a0211
commit 518a34c286
4 changed files with 5 additions and 4 deletions

View File

@ -73,8 +73,9 @@ Sprite *Blitter_8bppSimple::Encode(SpriteType, const SpriteLoader::SpriteCollect
dest_sprite->y_offs = root_sprite.y_offs;
/* Copy over only the 'remap' channel, as that is what we care about in 8bpp */
uint8_t *dst = reinterpret_cast<uint8_t *>(dest_sprite->data);
for (int i = 0; i < root_sprite.height * root_sprite.width; i++) {
dest_sprite->data[i] = root_sprite.data[i].m;
dst[i] = root_sprite.data[i].m;
}
return dest_sprite;

View File

@ -836,7 +836,7 @@ static void GenerateTerrain(int type, uint flag)
if (DiagDirToAxis(direction) == AXIS_Y) std::swap(w, h);
const uint8_t *p = templ->data;
const uint8_t *p = reinterpret_cast<const uint8_t *>(templ->data);
if ((flag & 4) != 0) {
/* This is only executed in secondary/tertiary loops to generate the terrain for arctic and tropic.

View File

@ -526,7 +526,7 @@ static void *ReadSprite(const SpriteCache *sc, SpriteID id, SpriteType sprite_ty
s->y_offs = root_sprite.y_offs;
SpriteLoader::CommonPixel *src = root_sprite.data;
uint8_t *dest = s->data;
uint8_t *dest = reinterpret_cast<uint8_t *>(s->data);
while (num-- > 0) {
*dest++ = src->m;
src++;

View File

@ -19,7 +19,7 @@ struct Sprite {
uint16_t width; ///< Width of the sprite.
int16_t x_offs; ///< Number of pixels to shift the sprite to the right.
int16_t y_offs; ///< Number of pixels to shift the sprite downwards.
uint8_t data[]; ///< Sprite data.
std::byte data[]; ///< Sprite data.
};
enum SpriteCacheCtrlFlags : uint8_t {