Add rjpeg_free

This commit is contained in:
twinaphex 2016-05-13 08:16:13 +02:00
parent d3df016005
commit 17d39fd54f
3 changed files with 18 additions and 3 deletions

View File

@ -22,6 +22,7 @@ void image_transfer_free(void *data, enum image_type_enum type)
break;
case IMAGE_TYPE_JPEG:
#ifdef HAVE_RJPEG
rjpeg_free((rjpeg_t*)data);
#endif
break;
}
@ -34,12 +35,16 @@ void *image_transfer_new(enum image_type_enum type)
case IMAGE_TYPE_PNG:
#ifdef HAVE_RPNG
return rpng_alloc();
#endif
#else
break;
#endif
case IMAGE_TYPE_JPEG:
#ifdef HAVE_RJPEG
return rjpeg_alloc();
#else
break;
#endif
default:
break;
}

View File

@ -2467,7 +2467,15 @@ bool rjpeg_image_load(uint8_t *_buf, void *data, size_t size,
return true;
}
void *rjpeg_alloc(void)
void rjpeg_free(rjpeg_t *rjpeg)
{
if (!rjpeg)
return;
free(rjpeg);
}
rjpeg_t *rjpeg_alloc(void)
{
rjpeg_t *rjpeg = (rjpeg_t*)calloc(1, sizeof(*rjpeg));
if (!rjpeg)

View File

@ -37,7 +37,9 @@ typedef struct rjpeg rjpeg_t;
bool rjpeg_image_load(uint8_t *buf, void *data, size_t size,
unsigned a_shift, unsigned r_shift, unsigned g_shift, unsigned b_shift);
void *rjpeg_alloc(void);
void rjpeg_free(rjpeg_t *rjpeg);
rjpeg_t *rjpeg_alloc(void);
RETRO_END_DECLS