Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
This commit is contained in:
@@ -29,18 +29,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 */
|
||||
@@ -54,11 +54,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 */
|
||||
@@ -146,7 +146,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)];
|
||||
@@ -161,7 +161,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 {
|
||||
@@ -285,10 +285,10 @@ 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_COUNT];
|
||||
uint16_t *dst_n_orig[ZOOM_LVL_COUNT];
|
||||
|
||||
/* lengths of streams */
|
||||
uint32 lengths[ZOOM_LVL_COUNT][2];
|
||||
uint32_t lengths[ZOOM_LVL_COUNT][2];
|
||||
|
||||
ZoomLevel zoom_min;
|
||||
ZoomLevel zoom_max;
|
||||
@@ -308,25 +308,25 @@ template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const
|
||||
uint size = src_orig->height * src_orig->width;
|
||||
|
||||
dst_px_orig[z] = CallocT<Colour>(size + src_orig->height * 2);
|
||||
dst_n_orig[z] = CallocT<uint16>(size * 2 + src_orig->height * 4 * 2);
|
||||
dst_n_orig[z] = CallocT<uint16_t>(size * 2 + src_orig->height * 4 * 2);
|
||||
|
||||
uint32 *dst_px_ln = (uint32 *)dst_px_orig[z];
|
||||
uint32 *dst_n_ln = (uint32 *)dst_n_orig[z];
|
||||
uint32_t *dst_px_ln = (uint32_t *)dst_px_orig[z];
|
||||
uint32_t *dst_n_ln = (uint32_t *)dst_n_orig[z];
|
||||
|
||||
const SpriteLoader::CommonPixel *src = (const SpriteLoader::CommonPixel *)src_orig->data;
|
||||
|
||||
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++;
|
||||
|
||||
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) {
|
||||
@@ -345,7 +345,7 @@ template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const
|
||||
*dst_n = src->m;
|
||||
if (src->m != 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;
|
||||
@@ -383,13 +383,13 @@ 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
|
||||
|
Reference in New Issue
Block a user