X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=blobdiff_plain;f=src%2Fimage_load_jpeg.c;h=0c3c3199ad360ac9615751293fee430b5122f865;hp=fc00ffc5ca306e1afc882a5fe1ac50a82787b4d4;hb=e436ea53511e1dadab981af18b237fee83fde39b;hpb=2dfa5f58107ba16e171e2e65524859a42b057742 diff --git a/src/image_load_jpeg.c b/src/image_load_jpeg.c index fc00ffc5..0c3c3199 100644 --- a/src/image_load_jpeg.c +++ b/src/image_load_jpeg.c @@ -14,7 +14,7 @@ * * Copyright (C) 1999 Michael Zucchi * Copyright (C) 1999 The Free Software Foundation - * + * * Progressive loading code Copyright (C) 1999 Red Hat, Inc. * * Authors: Michael Zucchi @@ -77,7 +77,7 @@ struct error_handler_data { /* explode gray image data from jpeg library into rgb components in pixbuf */ static void explode_gray_into_buf (struct jpeg_decompress_struct *cinfo, - guchar **lines) + guchar **lines) { gint i, j; guint w; @@ -108,7 +108,7 @@ explode_gray_into_buf (struct jpeg_decompress_struct *cinfo, static void convert_cmyk_to_rgb (struct jpeg_decompress_struct *cinfo, - guchar **lines) + guchar **lines) { gint i, j; @@ -171,8 +171,8 @@ fatal_error_handler (j_common_ptr cinfo) if (errmgr->error && *errmgr->error == NULL) { g_set_error (errmgr->error, GDK_PIXBUF_ERROR, - cinfo->err->msg_code == JERR_OUT_OF_MEMORY - ? GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY + cinfo->err->msg_code == JERR_OUT_OF_MEMORY + ? GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY : GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Error interpreting JPEG image file (%s)"), buffer); @@ -199,7 +199,7 @@ void image_loader_jpeg_read_scanline(struct jpeg_decompress_struct *cinfo, gucha gint i; lptr = lines; - for (i = 0; i < cinfo->rec_outbuf_height; i++) + for (i = 0; i < cinfo->rec_outbuf_height; i++) { *lptr++ = *dptr; *dptr += rowstride; @@ -207,7 +207,7 @@ void image_loader_jpeg_read_scanline(struct jpeg_decompress_struct *cinfo, gucha jpeg_read_scanlines (cinfo, lines, cinfo->rec_outbuf_height); - switch (cinfo->out_color_space) + switch (cinfo->out_color_space) { case JCS_GRAYSCALE: explode_gray_into_buf (cinfo, lines); @@ -238,7 +238,7 @@ static void skip_input_data (j_decompress_ptr cinfo, long num_bytes) { ERREXIT(cinfo, JERR_INPUT_EOF); } - else if (num_bytes > 0) + else if (num_bytes > 0) { src->next_input_byte += (size_t) num_bytes; src->bytes_in_buffer -= (size_t) num_bytes; @@ -249,7 +249,7 @@ static void set_mem_src (j_decompress_ptr cinfo, void* buffer, long nbytes) { struct jpeg_source_mgr* src; - if (cinfo->src == NULL) + if (cinfo->src == NULL) { /* first time for this JPEG object? */ cinfo->src = (struct jpeg_source_mgr *) (*cinfo->mem->alloc_small) ( (j_common_ptr) cinfo, JPOOL_PERMANENT, @@ -324,7 +324,7 @@ static gboolean image_loader_jpeg_load (gpointer loader, const guchar *buf, gsiz jerr.error = error; - if (setjmp(jerr.setjmp_buffer)) + if (setjmp(jerr.setjmp_buffer)) { /* 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. @@ -348,7 +348,7 @@ static gboolean image_loader_jpeg_load (gpointer loader, const guchar *buf, gsiz jpeg_read_header(&cinfo2, TRUE); if (cinfo.image_width != cinfo2.image_width || - cinfo.image_height != cinfo2.image_height) + cinfo.image_height != cinfo2.image_height) { DEBUG_1("stereo data with different size"); jpeg_destroy_decompress(&cinfo2); @@ -387,7 +387,7 @@ static gboolean image_loader_jpeg_load (gpointer loader, const guchar *buf, gsiz { if (cinfo.output_width != cinfo2.output_width || cinfo.output_height != cinfo2.output_height || - cinfo.out_color_components != cinfo2.out_color_components) + cinfo.out_color_components != cinfo2.out_color_components) { DEBUG_1("stereo data with different output size"); jpeg_destroy_decompress(&cinfo2); @@ -396,11 +396,11 @@ static gboolean image_loader_jpeg_load (gpointer loader, const guchar *buf, gsiz } - lj->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, - cinfo.out_color_components == 4 ? TRUE : FALSE, + lj->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, + cinfo.out_color_components == 4 ? TRUE : FALSE, 8, lj->stereo ? cinfo.output_width * 2: cinfo.output_width, cinfo.output_height); - if (!lj->pixbuf) + if (!lj->pixbuf) { jpeg_destroy_decompress (&cinfo); if (lj->stereo) jpeg_destroy_decompress (&cinfo2); @@ -414,7 +414,7 @@ static gboolean image_loader_jpeg_load (gpointer loader, const guchar *buf, gsiz dptr2 = gdk_pixbuf_get_pixels(lj->pixbuf) + ((cinfo.out_color_components == 4) ? 4 * cinfo.output_width : 3 * cinfo.output_width); - while (cinfo.output_scanline < cinfo.output_height && !lj->abort) + while (cinfo.output_scanline < cinfo.output_height && !lj->abort) { guint scanline = cinfo.output_scanline; image_loader_jpeg_read_scanline(&cinfo, &dptr, rowstride);