[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29115] trunk/blender/source/blender/imbuf /intern: * Only print libtiff debug messages to the console when in debug mode

Matt Ebb matt at mke3.net
Tue Jun 1 03:01:26 CEST 2010


Revision: 29115
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29115
Author:   broken
Date:     2010-06-01 03:01:25 +0200 (Tue, 01 Jun 2010)

Log Message:
-----------
* Only print libtiff debug messages to the console when in debug mode
* Allow loading non 3/4 channel TIFFs (eg. greyscale). This was already 
working, but disabled out of caution. Seems to work fine in my recent tests though.

Modified Paths:
--------------
    trunk/blender/source/blender/imbuf/intern/IMB_filetype.h
    trunk/blender/source/blender/imbuf/intern/filetype.c
    trunk/blender/source/blender/imbuf/intern/tiff.c

Modified: trunk/blender/source/blender/imbuf/intern/IMB_filetype.h
===================================================================
--- trunk/blender/source/blender/imbuf/intern/IMB_filetype.h	2010-06-01 00:16:51 UTC (rev 29114)
+++ trunk/blender/source/blender/imbuf/intern/IMB_filetype.h	2010-06-01 01:01:25 UTC (rev 29115)
@@ -109,6 +109,7 @@
 int imb_savehdr(struct ImBuf * ibuf, char *name, int flags);
 
 /* tiff */
+void imb_inittiff(void);
 int imb_is_a_tiff(unsigned char *buf);
 struct ImBuf *imb_loadtiff(unsigned char *mem, int size, int flags);
 void imb_loadtiletiff(struct ImBuf *ibuf, unsigned char *mem, int size,

Modified: trunk/blender/source/blender/imbuf/intern/filetype.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/filetype.c	2010-06-01 00:16:51 UTC (rev 29114)
+++ trunk/blender/source/blender/imbuf/intern/filetype.c	2010-06-01 01:01:25 UTC (rev 29115)
@@ -54,9 +54,6 @@
 void quicktime_exit(void);
 #endif
 
-void libtiff_init(void);
-void libtiff_exit(void);
-
 ImFileType IMB_FILE_TYPES[]= {
 	{NULL, NULL, imb_is_a_iris, imb_ftype_iris, imb_loadiris, imb_saveiris, NULL, 0, IMAGIC},
 	{NULL, NULL, imb_is_a_jpeg, imb_ftype_default, imb_load_jpeg, imb_savejpeg, NULL, 0, JPG},
@@ -66,7 +63,7 @@
 	{NULL, NULL, imb_is_dpx, imb_ftype_default, imb_loaddpx, imb_save_dpx, NULL, IM_FTYPE_FLOAT, DPX},
 	{NULL, NULL, imb_is_cineon, imb_ftype_default, imb_loadcineon, imb_savecineon, NULL, IM_FTYPE_FLOAT, CINEON},
 #ifdef WITH_TIFF
-	{NULL, NULL, imb_is_a_tiff, imb_ftype_default, imb_loadtiff, imb_savetiff, imb_loadtiletiff, 0, TIF},
+	{imb_inittiff, NULL, imb_is_a_tiff, imb_ftype_default, imb_loadtiff, imb_savetiff, imb_loadtiletiff, 0, TIF},
 #elif defined(__APPLE__) && defined(IMBUF_COCOA)
 	{NULL, NULL, imb_is_a_cocoa, imb_ftype_cocoa, imb_imb_cocoaLoadImage, imb_savecocoa, NULL, 0, TIF},
 #endif

Modified: trunk/blender/source/blender/imbuf/intern/tiff.c
===================================================================
--- trunk/blender/source/blender/imbuf/intern/tiff.c	2010-06-01 00:16:51 UTC (rev 29114)
+++ trunk/blender/source/blender/imbuf/intern/tiff.c	2010-06-01 01:01:25 UTC (rev 29115)
@@ -356,6 +356,7 @@
 }
 
 
+#if 0
 /* 
  * Use the libTIFF RGBAImage API to read a TIFF image.
  * This function uses the "RGBA Image" support from libtiff, which enables
@@ -387,6 +388,7 @@
 
 	return success;
 }
+#endif
 
 /* 
  * Use the libTIFF scanline API to read a TIFF image.
@@ -409,12 +411,6 @@
 	TIFFGetField(image, TIFFTAG_PLANARCONFIG, &config);
 	scanline = TIFFScanlineSize(image);
 	
-	/* if file has an unsupported channel count, use libTIFF to 
-	 * convert to an 8 bit RGBA image */
-	if (!ELEM(spp, 3, 4))
-		return imb_read_tiff_pixels_rgba(ibuf, image, premul);
-
-	
 	if (bitspersample == 32) {
 		ib_flag = IB_rectfloat;
 		fbuf = (float *)_TIFFmalloc(scanline);
@@ -427,7 +423,7 @@
 	}
 	
 	tmpibuf= IMB_allocImBuf(ibuf->x, ibuf->y, ibuf->depth, ib_flag, 0);
-
+	
 	/* contiguous channels: RGBRGBRGB */
 	if (config == PLANARCONFIG_CONTIG) {
 		for (row = 0; row < ibuf->y; row++) {
@@ -512,6 +508,12 @@
 	return success;
 }
 
+void imb_inittiff(void)
+{
+	if (!(G.f & G_DEBUG))
+		TIFFSetErrorHandler(NULL);
+}
+
 /**
  * Loads a TIFF file.
  *





More information about the Bf-blender-cvs mailing list