(RJPEG) Cleanups

This commit is contained in:
twinaphex 2016-12-18 12:15:36 +01:00
parent 222650df35
commit 35de6df7f9

View File

@ -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);
@ -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);