Adding of _t to (u)int types, and WChar to char32_t

See: eaae0bb5e
This commit is contained in:
Jonathan G Rennison
2024-01-07 16:41:53 +00:00
parent 55d78a23be
commit 97e6f3062e
655 changed files with 7555 additions and 7555 deletions

View File

@@ -31,18 +31,18 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
{
const SpriteData *src = (const SpriteData *)bp->sprite;
/* src_px : each line begins with uint32 n = 'number of bytes in this line',
/* src_px : each line begins with uint32_t n = 'number of bytes in this line',
* then n times is the Colour struct for this line */
const Colour *src_px = (const Colour *)(src->data + src->offset[zoom][0]);
/* src_n : each line begins with uint32 n = 'number of bytes in this line',
/* src_n : each line begins with uint32_t n = 'number of bytes in this line',
* then interleaved stream of 'm' and 'n' channels. 'm' is remap,
* 'n' is number of bytes with the same alpha channel class */
const uint16 *src_n = (const uint16 *)(src->data + src->offset[zoom][1]);
const uint16_t *src_n = (const uint16_t *)(src->data + src->offset[zoom][1]);
/* skip upper lines in src_px and src_n */
for (uint i = bp->skip_top; i != 0; i--) {
src_px = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
src_n = (const uint16 *)((const byte *)src_n + *(const uint32 *)src_n);
src_px = (const Colour *)((const byte *)src_px + *(const uint32_t *)src_px);
src_n = (const uint16_t *)((const byte *)src_n + *(const uint32_t *)src_n);
}
/* skip lines in dst */
@@ -56,11 +56,11 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
Colour *dst_ln = dst + bp->pitch;
/* next src line begins here */
const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32_t *)src_px);
src_px++;
/* next src_n line begins here */
const uint16 *src_n_ln = (const uint16 *)((const byte *)src_n + *(const uint32 *)src_n);
const uint16_t *src_n_ln = (const uint16_t *)((const byte *)src_n + *(const uint32_t *)src_n);
src_n += 2;
/* we will end this line when we reach this point */
@@ -153,7 +153,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
do {
uint m = *src_n;
if (m == 0) {
uint8 g = MakeDark(src_px->r, src_px->g, src_px->b);
uint8_t g = MakeDark(src_px->r, src_px->g, src_px->b);
*dst = ComposeColourRGBA(g, g, g, src_px->a, *dst);
} else {
uint r = remap[GB(m, 0, 8)];
@@ -168,7 +168,7 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
uint m = *src_n;
if (m == 0) {
if (src_px->a != 0) {
uint8 g = MakeDark(src_px->r, src_px->g, src_px->b);
uint8_t g = MakeDark(src_px->r, src_px->g, src_px->b);
*dst = ComposeColourRGBA(g, g, g, src_px->a, *dst);
}
} else {
@@ -308,14 +308,14 @@ template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const
*
* it has to be stored in one stream so fewer registers are used -
* x86 has problems with register allocation even with this solution */
uint16 *dst_n_orig[ZOOM_LVL_SPR_COUNT];
uint16_t *dst_n_orig[ZOOM_LVL_SPR_COUNT];
/* lengths of streams */
uint32 lengths[ZOOM_LVL_SPR_COUNT][2];
uint32_t lengths[ZOOM_LVL_SPR_COUNT][2];
ZoomLevel zoom_min;
ZoomLevel zoom_max;
uint8 missing_zoom_levels = 0;
uint8_t missing_zoom_levels = 0;
if (sprite[ZOOM_LVL_NORMAL].type == SpriteType::Font) {
zoom_min = ZOOM_LVL_NORMAL;
@@ -341,17 +341,17 @@ template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const
}
Colour * const px_buffer = MallocT<Colour>(px_size);
uint16 * const n_buffer = MallocT<uint16>(n_size);
uint16_t * const n_buffer = MallocT<uint16_t>(n_size);
Colour *px_buffer_next = px_buffer;
uint16 *n_buffer_next = n_buffer;
uint16_t *n_buffer_next = n_buffer;
for (ZoomLevel z = zoom_min; z <= zoom_max; z++) {
const SpriteLoader::Sprite *src_orig = &sprite[z];
dst_px_orig[z] = px_buffer_next;
dst_n_orig[z] = n_buffer_next;
uint32 *dst_px_ln = (uint32 *)px_buffer_next;
uint32 *dst_n_ln = (uint32 *)n_buffer_next;
uint32_t *dst_px_ln = (uint32_t *)px_buffer_next;
uint32_t *dst_n_ln = (uint32_t *)n_buffer_next;
const SpriteLoader::CommonPixel *src = (const SpriteLoader::CommonPixel *)src_orig->data;
@@ -365,16 +365,16 @@ template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const
for (uint y = src_orig->height; y > 0; y--) {
/* Index 0 of dst_px and dst_n is left as space to save the length of the row to be filled later. */
Colour *dst_px = (Colour *)&dst_px_ln[1];
uint16 *dst_n = (uint16 *)&dst_n_ln[1];
uint16_t *dst_n = (uint16_t *)&dst_n_ln[1];
uint16 *dst_len = dst_n++;
uint16_t *dst_len = dst_n++;
*dst_len = 0;
uint last = 3;
int len = 0;
for (uint x = src_orig->width; x > 0; x--) {
uint8 a = src->a;
uint8_t a = src->a;
uint t = a > 0 && a < 255 ? 1 : a;
if (last != t || len == 65535) {
@@ -396,7 +396,7 @@ template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const
*dst_n = 0;
/* Get brightest value */
uint8 rgb_max = std::max({ src->r, src->g, src->b });
uint8_t rgb_max = std::max({ src->r, src->g, src->b });
/* Black pixel (8bpp or old 32bpp image), so use default value */
if (rgb_max == 0) rgb_max = DEFAULT_BRIGHTNESS;
@@ -411,7 +411,7 @@ template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const
if (src->m >= PALETTE_ANIM_START) flags &= ~BSF_NO_ANIM;
/* Get brightest value */
uint8 rgb_max = std::max({ src->r, src->g, src->b });
uint8_t rgb_max = std::max({ src->r, src->g, src->b });
/* Black pixel (8bpp or old 32bpp image), so use default value */
if (rgb_max == 0) rgb_max = DEFAULT_BRIGHTNESS;
@@ -450,20 +450,20 @@ template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const
}
dst_px = (Colour *)AlignPtr(dst_px, 4);
dst_n = (uint16 *)AlignPtr(dst_n, 4);
dst_n = (uint16_t *)AlignPtr(dst_n, 4);
*dst_px_ln = (uint8 *)dst_px - (uint8 *)dst_px_ln;
*dst_n_ln = (uint8 *)dst_n - (uint8 *)dst_n_ln;
*dst_px_ln = (uint8_t *)dst_px - (uint8_t *)dst_px_ln;
*dst_n_ln = (uint8_t *)dst_n - (uint8_t *)dst_n_ln;
dst_px_ln = (uint32 *)dst_px;
dst_n_ln = (uint32 *)dst_n;
dst_px_ln = (uint32_t *)dst_px;
dst_n_ln = (uint32_t *)dst_n;
}
lengths[z][0] = (byte *)dst_px_ln - (byte *)dst_px_orig[z]; // all are aligned to 4B boundary
lengths[z][1] = (byte *)dst_n_ln - (byte *)dst_n_orig[z];
px_buffer_next = (Colour *)dst_px_ln;
n_buffer_next = (uint16 *)dst_n_ln;
n_buffer_next = (uint16_t *)dst_n_ln;
}
uint len = 0; // total length of data
@@ -490,7 +490,7 @@ template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const
/* Store sprite flags. */
dst->flags = flags;
uint32 next_offset = 0;
uint32_t next_offset = 0;
for (ZoomLevel z = zoom_min; z <= zoom_max; z++) {
dst->offset[z][0] = next_offset;
dst->offset[z][1] = lengths[z][0] + next_offset;