diff options
Diffstat (limited to 'source/blender/imbuf/intern/dynlibtiff.c')
-rw-r--r-- | source/blender/imbuf/intern/dynlibtiff.c | 280 |
1 files changed, 0 insertions, 280 deletions
diff --git a/source/blender/imbuf/intern/dynlibtiff.c b/source/blender/imbuf/intern/dynlibtiff.c deleted file mode 100644 index eb1b5f8e10a..00000000000 --- a/source/blender/imbuf/intern/dynlibtiff.c +++ /dev/null @@ -1,280 +0,0 @@ -/** - * Dynamically loaded libtiff support. - * - * This file is automatically generated by the gen_dynlibtiff.py script. - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * Contributor(s): Jonathan Merritt. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** - * To use the dynamic libtiff support, you must initialize the library using: - * libtiff_init() - * This attempts to load libtiff dynamically at runtime. G.have_libtiff will - * be set to indicate whether or not libtiff is available. If libtiff is - * not available, Blender can proceed with no ill effects, provided that - * it does not attempt to use any of the libtiff_ functions. When you're - * finished, close the library with: - * libtiff_exit() - * These functions are both declared in IMB_imbuf.h - * - * The functions provided by dyn_libtiff.h are the same as those in the - * normal static / shared libtiff, except that they are prefixed by the - * string "libtiff_" to indicate that they belong to a dynamically-loaded - * version. - */ -#include "dynlibtiff.h" - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> - -#include "BLI_blenlib.h" - -#include "imbuf.h" -#include "IMB_imbuf.h" - -#include "BKE_global.h" -#include "PIL_dynlib.h" - -/********************* - * LOCAL DEFINITIONS * - *********************/ -PILdynlib *libtiff = NULL; -void libtiff_loadlibtiff(void); -void* libtiff_findsymbol(char*); -int libtiff_load_symbols(void); - - -/************************** - * LIBRARY INITIALIZATION * - **************************/ - -void libtiff_loadlibtiff(void) -{ - char *filename; - libtiff = NULL; - - filename = getenv("BF_TIFF_LIB"); - if (filename) libtiff = PIL_dynlib_open(filename); - if (libtiff != NULL) return; - - /* Try to find libtiff in a couple of standard places */ -#ifdef __APPLE__ - /* OSX has version specific library */ - //standard install location - libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.3.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.4.dylib"); - if (libtiff != NULL) return; - //inside the blender app package contents/resources - libtiff = PIL_dynlib_open("@executable_path/../resources/libtiff.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("@executable_path/../resources/libtiff.3.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("@executable_path/../resources/libtiff.4.dylib"); - if (libtiff != NULL) return; - //inside the blender app package contents/frameworks - libtiff = PIL_dynlib_open("@executable_path/../frameworks/libtiff.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("@executable_path/../frameworks/libtiff.3.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("@executable_path/../frameworks/libtiff.4.dylib"); - if (libtiff != NULL) return; - //along side the blender app package - libtiff = PIL_dynlib_open("@executable_path/../../../libtiff.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("@executable_path/../../../libtiff.3.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("@executable_path/../../../libtiff.4.dylib"); - if (libtiff != NULL) return; - //inside the blender app package contents/MacOS - libtiff = PIL_dynlib_open("@executable_path/libtiff.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("@executable_path/libtiff.3.dylib"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("@executable_path/libtiff.4.dylib"); - if (libtiff != NULL) return; -#else - libtiff = PIL_dynlib_open("libtiff.so"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("libtiff.so.3"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("libtiff.so.4"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("libtiff.dll"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("/usr/lib/libtiff.so"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("/usr/lib/libtiff.so.3"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("/usr/lib/libtiff.so.4"); - if (libtiff != NULL) return; -#ifdef __x86_64__ - libtiff = PIL_dynlib_open("/usr/lib64/libtiff.so"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("/usr/lib64/libtiff.so.3"); - if (libtiff != NULL) return; - libtiff = PIL_dynlib_open("/usr/lib64/libtiff.so.4"); - if (libtiff != NULL) return; -#endif - libtiff = PIL_dynlib_open("/usr/local/lib/libtiff.so"); - if (libtiff != NULL) return; - /* For solaris */ - libtiff = PIL_dynlib_open("/usr/openwin/lib/libtiff.so"); -#endif - -} - -void *libtiff_findsymbol(char *name) -{ - void *symbol = NULL; - assert(libtiff != NULL); - symbol = PIL_dynlib_find_symbol(libtiff, name); - if (symbol == NULL) { - char *err = PIL_dynlib_get_error_as_string(libtiff); - - if (err) printf("libtiff_findsymbol: error %s\n",err); - else printf("libtiff_findsymbol: error Unknown.\n"); - - libtiff = NULL; - G.have_libtiff = (0); - return NULL; - } - return symbol; -} - -void libtiff_init(void) -{ - if (libtiff != NULL) { - printf("libtiff_init: Attempted to load libtiff twice!\n"); - return; - } - libtiff_loadlibtiff(); - G.have_libtiff = ((libtiff != NULL) && (libtiff_load_symbols())); - - if (!G.have_libtiff && (G.f & G_DEBUG)) { - printf("Unable to load: libtiff.\n"); - printf("Try setting the BF_TIFF_LIB environment variable if you want this support.\n"); - printf("Example: setenv BF_TIFF_LIB /usr/lib/libtiff.so\n"); - } -} - -void libtiff_exit(void) -{ - if (libtiff != NULL) { - PIL_dynlib_close(libtiff); - libtiff = NULL; - } -} - - -int libtiff_load_symbols(void) -{ - /* Attempt to load TIFFClientOpen */ - libtiff_TIFFClientOpen = libtiff_findsymbol("TIFFClientOpen"); - if (libtiff_TIFFClientOpen == NULL) { - return (0); - } - /* Attempt to load TIFFClose */ - libtiff_TIFFClose = libtiff_findsymbol("TIFFClose"); - if (libtiff_TIFFClose == NULL) { - return (0); - } - /* Attempt to load TIFFGetField */ - libtiff_TIFFGetField = libtiff_findsymbol("TIFFGetField"); - if (libtiff_TIFFGetField == NULL) { - return (0); - } - /* Attempt to load TIFFOpen */ - libtiff_TIFFOpen = libtiff_findsymbol("TIFFOpen"); - if (libtiff_TIFFOpen == NULL) { - return (0); - } - /* Attempt to load TIFFReadRGBAImage */ - libtiff_TIFFReadRGBAImage = libtiff_findsymbol("TIFFReadRGBAImage"); - if (libtiff_TIFFReadRGBAImage == NULL) { - return (0); - } - /* Attempt to load TIFFSetField */ - libtiff_TIFFSetField = libtiff_findsymbol("TIFFSetField"); - if (libtiff_TIFFSetField == NULL) { - return (0); - } - /* Attempt to load TIFFWriteEncodedStrip */ - libtiff_TIFFWriteEncodedStrip = libtiff_findsymbol("TIFFWriteEncodedStrip"); - if (libtiff_TIFFWriteEncodedStrip == NULL) { - return (0); - } - /* Attempt to load _TIFFfree */ - libtiff__TIFFfree = libtiff_findsymbol("_TIFFfree"); - if (libtiff__TIFFfree == NULL) { - return (0); - } - /* Attempt to load _TIFFmalloc */ - libtiff__TIFFmalloc = libtiff_findsymbol("_TIFFmalloc"); - if (libtiff__TIFFmalloc == NULL) { - return (0); - } - /* Attempt to load TIFFSetDirectory */ - libtiff_TIFFSetDirectory = libtiff_findsymbol("TIFFSetDirectory"); - if (libtiff_TIFFSetDirectory == NULL) { - return (0); - } - /* Attempt to load TIFFNumberOfDirectories */ - libtiff_TIFFNumberOfDirectories = libtiff_findsymbol("TIFFNumberOfDirectories"); - if (libtiff_TIFFNumberOfDirectories == NULL) { - return (0); - } - /* Attempt to load TIFFIsTiled */ - libtiff_TIFFIsTiled = libtiff_findsymbol("TIFFIsTiled"); - if (libtiff_TIFFIsTiled == NULL) { - return (0); - } - /* Attempt to load TIFFReadRGBATile */ - libtiff_TIFFReadRGBATile = libtiff_findsymbol("TIFFReadRGBATile"); - if (libtiff_TIFFReadRGBATile == NULL) { - return (0); - } - return (1); -} - - -/******************* - * SYMBOL POINTERS * - *******************/ - -TIFF* (*libtiff_TIFFClientOpen)(const char*, const char*, thandle_t, TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc) = NULL; -void (*libtiff_TIFFClose)(TIFF*) = NULL; -int (*libtiff_TIFFGetField)(TIFF*, ttag_t, ...) = NULL; -TIFF* (*libtiff_TIFFOpen)(const char*, const char*) = NULL; -int (*libtiff_TIFFReadRGBAImage)(TIFF*, uint32, uint32, uint32*, int) = NULL; -int (*libtiff_TIFFSetField)(TIFF*, ttag_t, ...) = NULL; -tsize_t (*libtiff_TIFFWriteEncodedStrip)(TIFF*, tstrip_t, tdata_t, tsize_t) = NULL; -void (*libtiff__TIFFfree)(tdata_t) = NULL; -tdata_t (*libtiff__TIFFmalloc)(tsize_t) = NULL; -int (*libtiff_TIFFSetDirectory)(TIFF*, tdir_t) = NULL; -tdir_t (*libtiff_TIFFNumberOfDirectories)(TIFF*) = NULL; -int (*libtiff_TIFFIsTiled)(TIFF*) = NULL; -int (*libtiff_TIFFReadRGBATile)(TIFF*, uint32, uint32, uint32 * ) = NULL; - - |