From: <enl...@li...> - 2004-01-03 05:42:45
|
Enlightenment CVS committal Author : raster Project : e17 Module : libs/imlib2 Dir : e17/libs/imlib2/loaders Modified Files: loader_tiff.c Log Message: handle error stuff right =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/imlib2/loaders/loader_tiff.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- loader_tiff.c 7 Nov 2003 07:39:32 -0000 1.12 +++ loader_tiff.c 3 Jan 2004 05:42:43 -0000 1.13 @@ -154,6 +154,7 @@ TIFFRGBAImage_Extra rgba_image; uint32 *rast = NULL; uint32 width, height, num_pixels; + char txt[1024]; if (im->data) return 0; @@ -184,14 +185,20 @@ if (!tif) return 0; - if ((!TIFFRGBAImageOK(tif, "Cannot be processed by libtiff")) - || (!TIFFRGBAImageBegin((TIFFRGBAImage *) & rgba_image, tif, 0, - "Error reading tiff"))) + strcpy(txt, "Cannot be processed by libtiff"); + if (!TIFFRGBAImageOK(tif, txt)) { TIFFClose(tif); return 0; } - + strcpy(txt, "Cannot begin reading tiff"); + if (!TIFFRGBAImageBegin((TIFFRGBAImage *) & rgba_image, tif, 0, + txt)) + { + TIFFClose(tif); + return 0; + } + rgba_image.image = im; im->w = width = rgba_image.rgba.width; im->h = height = rgba_image.rgba.height; @@ -254,18 +261,24 @@ rgba_image.rgba.put.separate = put_separate_and_raster; } } - - if (!TIFFRGBAImageGet((TIFFRGBAImage *) & rgba_image, - rast, width, height)) - { - _TIFFfree(rast); - free(im->data); - im->data = NULL; - TIFFRGBAImageEnd((TIFFRGBAImage *) & rgba_image); - TIFFClose(tif); - - return 0; - } + if (rgba_image.rgba.samplesperpixel == 8) + { + if (!TIFFRGBAImageGet((TIFFRGBAImage *) & rgba_image, + rast, width, height)) + { + _TIFFfree(rast); + free(im->data); + im->data = NULL; + TIFFRGBAImageEnd((TIFFRGBAImage *) & rgba_image); + TIFFClose(tif); + + return 0; + } + } + else + { + printf("channel bits == %i\n", (int)rgba_image.rgba.samplesperpixel); + } _TIFFfree(rast); } |