From f13b5de61ef55cf942542088982492a4d1255d73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 12 Apr 2007 13:20:33 +0000 Subject: [PATCH] * EXIF data is now also parsed in case there was no ioExtension message passed in; the orientation was only honoured in case there was a message before. * Disabled error alerts; they are more annoying than helpful. * Bumped version to 1.2.0. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20664 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../translators/jpeg/JPEGTranslator.cpp | 26 +++++++++---------- src/add-ons/translators/jpeg/be_jerror.cpp | 4 +++ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/add-ons/translators/jpeg/JPEGTranslator.cpp b/src/add-ons/translators/jpeg/JPEGTranslator.cpp index 98b01f0924..14014c2f8f 100644 --- a/src/add-ons/translators/jpeg/JPEGTranslator.cpp +++ b/src/add-ons/translators/jpeg/JPEGTranslator.cpp @@ -53,7 +53,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. char translatorName[] = "JPEG Images"; char translatorInfo[] = "©2002-2003, Marcin Konicki\n" - "©2005-2006, Haiku\n" + "©2005-2007, Haiku\n" "\n" "Based on IJG library © 1991-1998, Thomas G. Lane\n" " http://www.ijg.org/files/\n" @@ -63,7 +63,7 @@ char translatorInfo[] = "With some colorspace conversion routines by Magnus Hellman\n" " http://www.bebits.com/app/802\n"; -int32 translatorVersion = 0x111; +int32 translatorVersion = 0x120; // Define the formats we know how to read translation_format inputFormats[] = { @@ -1379,31 +1379,29 @@ Decompress(BPositionIO *in, BPositionIO *out, BMessage* ioExtension) jpeg_create_decompress(&cinfo); be_jpeg_stdio_src(&cinfo, in); -#if 1 jpeg_save_markers(&cinfo, MARKER_EXIF, 131072); // make sure the EXIF tag is stored -#endif // Read info about image jpeg_read_header(&cinfo, TRUE); BMessage exif; - if (ioExtension != NULL) { - // add EXIF data to message, if any - jpeg_marker_struct* marker = cinfo.marker_list; - while (marker != NULL) { - if (marker->marker == MARKER_EXIF - && !strncmp((char*)marker->data, "Exif", 4)) { + // parse EXIF data and add it ioExtension, if any + jpeg_marker_struct* marker = cinfo.marker_list; + while (marker != NULL) { + if (marker->marker == MARKER_EXIF + && !strncmp((char*)marker->data, "Exif", 4)) { + if (ioExtension != NULL) { // Strip EXIF header from TIFF data ioExtension->AddData("exif", B_RAW_TYPE, (uint8 *)marker->data + 6, marker->data_length - 6); - - BMemoryIO io(marker->data + 6, marker->data_length - 6); - convert_exif_to_message(io, exif); } - marker = marker->next; + + BMemoryIO io(marker->data + 6, marker->data_length - 6); + convert_exif_to_message(io, exif); } + marker = marker->next; } // Default color info diff --git a/src/add-ons/translators/jpeg/be_jerror.cpp b/src/add-ons/translators/jpeg/be_jerror.cpp index 1d2b8aa6eb..f2713ee8cc 100644 --- a/src/add-ons/translators/jpeg/be_jerror.cpp +++ b/src/add-ons/translators/jpeg/be_jerror.cpp @@ -67,8 +67,10 @@ be_error_exit (j_common_ptr cinfo) /* Create the message */ (*cinfo->err->format_message) (cinfo, buffer); +#if 0 /* show error message */ (new BAlert("JPEG Library Error", buffer, "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); +#endif /* Let the memory manager delete any temp files before we die */ jpeg_destroy(cinfo); @@ -88,10 +90,12 @@ be_output_message (j_common_ptr cinfo) /* Create the message */ (*cinfo->err->format_message) (cinfo, buffer); +#if 0 /* If it's compressing or decompressing and user turned messages on */ if (!cinfo->is_decompressor || cinfo->err->ShowReadWarnings) /* show warning message */ (new BAlert("JPEG Library Warning", buffer, "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); +#endif }