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

View File

@ -2467,7 +2467,15 @@ bool rjpeg_image_load(uint8_t *_buf, void *data, size_t size,
return true; 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)); rjpeg_t *rjpeg = (rjpeg_t*)calloc(1, sizeof(*rjpeg));
if (!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, bool rjpeg_image_load(uint8_t *buf, void *data, size_t size,
unsigned a_shift, unsigned r_shift, unsigned g_shift, unsigned b_shift); 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 RETRO_END_DECLS