mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-14 00:05:24 +00:00
rjpeg_process_image - cleanup
This commit is contained in:
parent
d04810f5fd
commit
fae5eb89df
@ -2520,7 +2520,7 @@ int rjpeg_process_image(rjpeg_t *rjpeg, void **buf_data,
|
|||||||
{
|
{
|
||||||
int comp;
|
int comp;
|
||||||
uint32_t *img = NULL;
|
uint32_t *img = NULL;
|
||||||
uint32_t **pixels = (uint32_t**)buf_data;
|
uint32_t *pixels = NULL;
|
||||||
unsigned size_tex = 0;
|
unsigned size_tex = 0;
|
||||||
|
|
||||||
if (!rjpeg)
|
if (!rjpeg)
|
||||||
@ -2532,7 +2532,15 @@ int rjpeg_process_image(rjpeg_t *rjpeg, void **buf_data,
|
|||||||
return IMAGE_PROCESS_ERROR;
|
return IMAGE_PROCESS_ERROR;
|
||||||
|
|
||||||
size_tex = (*width) * (*height);
|
size_tex = (*width) * (*height);
|
||||||
*pixels = (uint32_t*)malloc(size_tex * sizeof(uint32_t));
|
pixels = (uint32_t*)malloc(size_tex * sizeof(uint32_t));
|
||||||
|
|
||||||
|
if (!pixels)
|
||||||
|
{
|
||||||
|
free(img);
|
||||||
|
return IMAGE_PROCESS_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
*buf_data = pixels;
|
||||||
|
|
||||||
/* Convert RGBA to ARGB */
|
/* Convert RGBA to ARGB */
|
||||||
do
|
do
|
||||||
@ -2542,7 +2550,7 @@ int rjpeg_process_image(rjpeg_t *rjpeg, void **buf_data,
|
|||||||
unsigned int B = texel & 0x00FF0000;
|
unsigned int B = texel & 0x00FF0000;
|
||||||
unsigned int G = texel & 0x0000FF00;
|
unsigned int G = texel & 0x0000FF00;
|
||||||
unsigned int R = texel & 0x000000FF;
|
unsigned int R = texel & 0x000000FF;
|
||||||
((unsigned int*)*pixels)[size_tex] = A | (R << 16) | G | (B >> 16);
|
((unsigned int*)pixels)[size_tex] = A | (R << 16) | G | (B >> 16);
|
||||||
}while(size_tex--);
|
}while(size_tex--);
|
||||||
|
|
||||||
free(img);
|
free(img);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user