X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fjpeg.c;h=21cc0f7cc897ecd80c4482a77bc64782dc0a570e;hp=f9cdf414a16be5a67d23c7e1e0045a846f6e3561;hb=9b328ffcb7522c4c0d021a1a8c68e95390e1b2a7;hpb=90aec6a9d4522c29c75bc85d5b4fd58e544fc3a3 diff --git a/lib/jpeg.c b/lib/jpeg.c index f9cdf41..21cc0f7 100644 --- a/lib/jpeg.c +++ b/lib/jpeg.c @@ -288,12 +288,11 @@ void mem_term_source (j_decompress_ptr cinfo) //printf("term %d\n", size - mgr->bytes_in_buffer); } -int jpeg_load_from_mem(unsigned char*_data, int _size, unsigned char*dest, int width, int height) +int jpeg_load_from_mem(unsigned char*_data, int _size, unsigned char**dest, int*width, int*height) { struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; struct jpeg_source_mgr mgr; - int y,x; data = _data; size = _size; @@ -312,12 +311,27 @@ int jpeg_load_from_mem(unsigned char*_data, int _size, unsigned char*dest, int w cinfo.src = &mgr; jpeg_read_header(&cinfo, TRUE); + cinfo.out_color_space == JCS_RGB; jpeg_start_decompress(&cinfo); + + *width = cinfo.output_width; + *height = cinfo.output_height; + *dest = malloc(cinfo.output_width * cinfo.output_height * 4); - for(y=0;y