mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-27 06:11:51 +00:00
[GX] fix image converters to avoid memory corruption, fixes crash on some overlays
This commit is contained in:
parent
b27f3242c0
commit
ea5ecd507d
26
gfx/image.c
26
gfx/image.c
@ -231,7 +231,7 @@ bool texture_image_load_argb_shift(const char *path, struct texture_image *out_i
|
||||
{ \
|
||||
const uint16_t *tmp_src = src; \
|
||||
uint16_t *tmp_dst = dst; \
|
||||
for (unsigned x = 0; x < width2 >> 2; x += 8, tmp_src += 32, tmp_dst += 128) \
|
||||
for (unsigned x = 0; x < width2 >> 3; x++, tmp_src += 8, tmp_dst += 32) \
|
||||
{ \
|
||||
tmp_dst[ 0 + off] = tmp_src[0]; \
|
||||
tmp_dst[ 16 + off] = tmp_src[1]; \
|
||||
@ -241,30 +241,6 @@ bool texture_image_load_argb_shift(const char *path, struct texture_image *out_i
|
||||
tmp_dst[ 18 + off] = tmp_src[5]; \
|
||||
tmp_dst[ 3 + off] = tmp_src[6]; \
|
||||
tmp_dst[ 19 + off] = tmp_src[7]; \
|
||||
tmp_dst[ 32 + off] = tmp_src[8]; \
|
||||
tmp_dst[ 48 + off] = tmp_src[9]; \
|
||||
tmp_dst[ 33 + off] = tmp_src[10]; \
|
||||
tmp_dst[ 49 + off] = tmp_src[11]; \
|
||||
tmp_dst[ 34 + off] = tmp_src[12]; \
|
||||
tmp_dst[ 50 + off] = tmp_src[13]; \
|
||||
tmp_dst[ 35 + off] = tmp_src[14]; \
|
||||
tmp_dst[ 51 + off] = tmp_src[15]; \
|
||||
tmp_dst[ 64 + off] = tmp_src[16]; \
|
||||
tmp_dst[ 80 + off] = tmp_src[17]; \
|
||||
tmp_dst[ 65 + off] = tmp_src[18]; \
|
||||
tmp_dst[ 81 + off] = tmp_src[19]; \
|
||||
tmp_dst[ 66 + off] = tmp_src[20]; \
|
||||
tmp_dst[ 82 + off] = tmp_src[21]; \
|
||||
tmp_dst[ 67 + off] = tmp_src[22]; \
|
||||
tmp_dst[ 83 + off] = tmp_src[23]; \
|
||||
tmp_dst[ 96 + off] = tmp_src[24]; \
|
||||
tmp_dst[112 + off] = tmp_src[25]; \
|
||||
tmp_dst[ 97 + off] = tmp_src[26]; \
|
||||
tmp_dst[113 + off] = tmp_src[27]; \
|
||||
tmp_dst[ 98 + off] = tmp_src[28]; \
|
||||
tmp_dst[114 + off] = tmp_src[29]; \
|
||||
tmp_dst[ 99 + off] = tmp_src[30]; \
|
||||
tmp_dst[115 + off] = tmp_src[31]; \
|
||||
} \
|
||||
src += tmp_pitch; \
|
||||
}
|
||||
|
@ -592,16 +592,10 @@ static void update_texture_asm(const uint32_t *src, const uint32_t *dst,
|
||||
{ \
|
||||
const uint32_t *tmp_src = src; \
|
||||
uint32_t *tmp_dst = dst; \
|
||||
for (unsigned x = 0; x < width2; x += 8, tmp_src += 8, tmp_dst += 32) \
|
||||
for (unsigned x = 0; x < width2 >> 1; x++, tmp_src += 2, tmp_dst += 8) \
|
||||
{ \
|
||||
tmp_dst[ 0 + off] = BLIT_LINE_16_CONV(tmp_src[0]); \
|
||||
tmp_dst[ 1 + off] = BLIT_LINE_16_CONV(tmp_src[1]); \
|
||||
tmp_dst[ 8 + off] = BLIT_LINE_16_CONV(tmp_src[2]); \
|
||||
tmp_dst[ 9 + off] = BLIT_LINE_16_CONV(tmp_src[3]); \
|
||||
tmp_dst[16 + off] = BLIT_LINE_16_CONV(tmp_src[4]); \
|
||||
tmp_dst[17 + off] = BLIT_LINE_16_CONV(tmp_src[5]); \
|
||||
tmp_dst[24 + off] = BLIT_LINE_16_CONV(tmp_src[6]); \
|
||||
tmp_dst[25 + off] = BLIT_LINE_16_CONV(tmp_src[7]); \
|
||||
} \
|
||||
src += tmp_pitch; \
|
||||
}
|
||||
@ -610,7 +604,7 @@ static void update_texture_asm(const uint32_t *src, const uint32_t *dst,
|
||||
{ \
|
||||
const uint16_t *tmp_src = src; \
|
||||
uint16_t *tmp_dst = dst; \
|
||||
for (unsigned x = 0; x < width2 >> 2; x += 8, tmp_src += 32, tmp_dst += 128) \
|
||||
for (unsigned x = 0; x < width2 >> 3; x++, tmp_src += 8, tmp_dst += 32) \
|
||||
{ \
|
||||
tmp_dst[ 0 + off] = tmp_src[0] | 0xFF00; \
|
||||
tmp_dst[ 16 + off] = tmp_src[1]; \
|
||||
@ -620,30 +614,6 @@ static void update_texture_asm(const uint32_t *src, const uint32_t *dst,
|
||||
tmp_dst[ 18 + off] = tmp_src[5]; \
|
||||
tmp_dst[ 3 + off] = tmp_src[6] | 0xFF00; \
|
||||
tmp_dst[ 19 + off] = tmp_src[7]; \
|
||||
tmp_dst[ 32 + off] = tmp_src[8] | 0xFF00; \
|
||||
tmp_dst[ 48 + off] = tmp_src[9]; \
|
||||
tmp_dst[ 33 + off] = tmp_src[10] | 0xFF00; \
|
||||
tmp_dst[ 49 + off] = tmp_src[11]; \
|
||||
tmp_dst[ 34 + off] = tmp_src[12] | 0xFF00; \
|
||||
tmp_dst[ 50 + off] = tmp_src[13]; \
|
||||
tmp_dst[ 35 + off] = tmp_src[14] | 0xFF00; \
|
||||
tmp_dst[ 51 + off] = tmp_src[15]; \
|
||||
tmp_dst[ 64 + off] = tmp_src[16] | 0xFF00; \
|
||||
tmp_dst[ 80 + off] = tmp_src[17]; \
|
||||
tmp_dst[ 65 + off] = tmp_src[18] | 0xFF00; \
|
||||
tmp_dst[ 81 + off] = tmp_src[19]; \
|
||||
tmp_dst[ 66 + off] = tmp_src[20] | 0xFF00; \
|
||||
tmp_dst[ 82 + off] = tmp_src[21]; \
|
||||
tmp_dst[ 67 + off] = tmp_src[22] | 0xFF00; \
|
||||
tmp_dst[ 83 + off] = tmp_src[23]; \
|
||||
tmp_dst[ 96 + off] = tmp_src[24] | 0xFF00; \
|
||||
tmp_dst[112 + off] = tmp_src[25]; \
|
||||
tmp_dst[ 97 + off] = tmp_src[26] | 0xFF00; \
|
||||
tmp_dst[113 + off] = tmp_src[27]; \
|
||||
tmp_dst[ 98 + off] = tmp_src[28] | 0xFF00; \
|
||||
tmp_dst[114 + off] = tmp_src[29]; \
|
||||
tmp_dst[ 99 + off] = tmp_src[30] | 0xFF00; \
|
||||
tmp_dst[115 + off] = tmp_src[31]; \
|
||||
} \
|
||||
src += tmp_pitch; \
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user