mirror of
https://github.com/libretro/RetroArch
synced 2025-01-31 15:32:59 +00:00
(RJPEG) Cleanups
This commit is contained in:
parent
222650df35
commit
35de6df7f9
@ -44,6 +44,14 @@ enum
|
|||||||
RJPEG_RGB_ALPHA
|
RJPEG_RGB_ALPHA
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
RJPEG_SCAN_LOAD = 0,
|
||||||
|
RJPEG_SCAN_TYPE,
|
||||||
|
RJPEG_SCAN_HEADER
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int (*read) (void *user,char *data,int size); /* fill 'data' with 'size' bytes. return number of bytes actually read */
|
int (*read) (void *user,char *data,int size); /* fill 'data' with 'size' bytes. return number of bytes actually read */
|
||||||
@ -191,7 +199,8 @@ static unsigned char *rjpeg__load_flip(rjpeg__context *s, unsigned *x, unsigned
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t *rjpeg_load_from_memory(const uint8_t *buffer, int len, unsigned *x, unsigned *y, int *comp, int req_comp)
|
static uint8_t *rjpeg_load_from_memory(const uint8_t *buffer, int len,
|
||||||
|
unsigned *x, unsigned *y, int *comp, int req_comp)
|
||||||
{
|
{
|
||||||
rjpeg__context s;
|
rjpeg__context s;
|
||||||
s.io.read = NULL;
|
s.io.read = NULL;
|
||||||
@ -201,13 +210,6 @@ static uint8_t *rjpeg_load_from_memory(const uint8_t *buffer, int len, unsigned
|
|||||||
return rjpeg__load_flip(&s,x,y,comp,req_comp);
|
return rjpeg__load_flip(&s,x,y,comp,req_comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
RJPEG_SCAN_LOAD = 0,
|
|
||||||
RJPEG_SCAN_TYPE,
|
|
||||||
RJPEG_SCAN_HEADER
|
|
||||||
};
|
|
||||||
|
|
||||||
static void rjpeg__refill_buffer(rjpeg__context *s)
|
static void rjpeg__refill_buffer(rjpeg__context *s)
|
||||||
{
|
{
|
||||||
int n = (s->io.read)(s->io_user_data,(char*)s->buffer_start,s->buflen);
|
int n = (s->io.read)(s->io_user_data,(char*)s->buffer_start,s->buflen);
|
||||||
@ -217,14 +219,14 @@ static void rjpeg__refill_buffer(rjpeg__context *s)
|
|||||||
/* at end of file, treat same as if from memory, but need to handle case
|
/* at end of file, treat same as if from memory, but need to handle case
|
||||||
* where s->img_buffer isn't pointing to safe memory, e.g. 0-byte file */
|
* where s->img_buffer isn't pointing to safe memory, e.g. 0-byte file */
|
||||||
s->read_from_callbacks = 0;
|
s->read_from_callbacks = 0;
|
||||||
s->img_buffer = s->buffer_start;
|
s->img_buffer = s->buffer_start;
|
||||||
s->img_buffer_end = s->buffer_start+1;
|
s->img_buffer_end = s->buffer_start+1;
|
||||||
*s->img_buffer = 0;
|
*s->img_buffer = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s->img_buffer = s->buffer_start;
|
s->img_buffer = s->buffer_start;
|
||||||
s->img_buffer_end = s->buffer_start + n;
|
s->img_buffer_end = s->buffer_start + n;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2586,7 +2588,7 @@ int rjpeg_process_image(rjpeg_t *rjpeg, void **buf_data,
|
|||||||
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);
|
||||||
};
|
}
|
||||||
|
|
||||||
free(img);
|
free(img);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user