X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fjpeg.c;h=21cc0f7cc897ecd80c4482a77bc64782dc0a570e;hp=1f7491015a9a33617f7b38b4cdb1199dbdd61ec8;hb=9b328ffcb7522c4c0d021a1a8c68e95390e1b2a7;hpb=02885fc850a390f4e7407140fdcb042a109c6582 diff --git a/lib/jpeg.c b/lib/jpeg.c index 1f74910..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