From 6dd1498f7c80345c4a34dcd5324bf1f55326f156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20=28kix=29?= Date: Thu, 20 Jun 2019 00:40:11 +0200 Subject: [PATCH] load_jpeg.c Style MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch is just coding style. Removes some empty lines,... Signed-off-by: Rodolfo García Peñas (kix) --- wrlib/load_jpeg.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/wrlib/load_jpeg.c b/wrlib/load_jpeg.c index f4462704..d4e3bcd1 100644 --- a/wrlib/load_jpeg.c +++ b/wrlib/load_jpeg.c @@ -117,7 +117,8 @@ RImage *RLoadJPEG(const char *file_name) jerr.pub.error_exit = my_error_exit; /* Establish the setjmp return context for my_error_exit to use. */ if (setjmp(jerr.setjmp_buffer)) { - /* If we get here, the JPEG code has signaled an error. + /* + * If we get here, the JPEG code has signaled an error. * We need to clean up the JPEG object, close the input file, and return. */ jpeg_destroy_decompress(&cinfo); @@ -126,11 +127,8 @@ RImage *RLoadJPEG(const char *file_name) } jpeg_create_decompress(&cinfo); - jpeg_stdio_src(&cinfo, file); - jpeg_read_header(&cinfo, TRUE); - if (cinfo.image_width < 1 || cinfo.image_height < 1) { RErrorCode = RERR_BADIMAGEFILE; jpeg_destroy_decompress(&cinfo); @@ -146,17 +144,16 @@ RImage *RLoadJPEG(const char *file_name) return NULL; } - if (cinfo.jpeg_color_space == JCS_GRAYSCALE) { + if (cinfo.jpeg_color_space == JCS_GRAYSCALE) cinfo.out_color_space = JCS_GRAYSCALE; - } else + else cinfo.out_color_space = JCS_RGB; + cinfo.quantize_colors = FALSE; cinfo.do_fancy_upsampling = FALSE; cinfo.do_block_smoothing = FALSE; jpeg_calc_output_dimensions(&cinfo); - image = RCreateImage(cinfo.image_width, cinfo.image_height, False); - if (!image) { RErrorCode = RERR_NOMEMORY; jpeg_destroy_decompress(&cinfo); @@ -166,10 +163,9 @@ RImage *RLoadJPEG(const char *file_name) return image; } + jpeg_start_decompress(&cinfo); - ptr = image->data; - if (cinfo.out_color_space == JCS_RGB) { while (cinfo.output_scanline < cinfo.output_height) { jpeg_read_scanlines(&cinfo, buffer, (JDIMENSION) 1);