Mac / COCOA :

- revert tiff load/save to use standard libtiff (to ensure 100% colorimetry & alpha interpretation across platforms)
- include patch #18720 to fix load of libtiff dynlib (if present on system)
This commit is contained in:
Damien Plisson 2009-11-02 11:20:31 +00:00
parent da1765765b
commit 3b43a5228e
7 changed files with 35 additions and 25 deletions

@ -24,13 +24,8 @@
#
# ***** END GPL LICENSE BLOCK *****
IF(WITH_COCOA)
FILE(GLOB SRC intern/*.c intern/*.m)
LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/dynlibtiff.c")
LIST(REMOVE_ITEM SRC "${CMAKE_CURRENT_SOURCE_DIR}/intern/tiff.c")
ELSE(WITH_COCOA)
FILE(GLOB SRC intern/*.c)
ENDIF(WITH_COCOA)
FILE(GLOB SRC intern/*.c)
SET(INC
. ../makesdna ../../../intern/guardedalloc ../../../intern/memutil ../blenlib

@ -2,10 +2,6 @@
Import ('env')
sources = env.Glob('intern/*.c')
if env['WITH_GHOST_COCOA']:
sources += env.Glob('intern/*.m')
sources.remove('intern/dynlibtiff.c')
sources.remove('intern/tiff.c')
incs = '. ../makesdna #/intern/guardedalloc #/intern/memutil ../blenlib'
incs += ' ../avi ../blenkernel'

@ -78,6 +78,34 @@ void libtiff_loadlibtiff(void)
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;
//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;
//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;
//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;
//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;
#else
libtiff = PIL_dynlib_open("libtiff.so");
if (libtiff != NULL) return;
libtiff = PIL_dynlib_open("libtiff.so.3");
@ -88,7 +116,6 @@ void libtiff_loadlibtiff(void)
if (libtiff != NULL) return;
libtiff = PIL_dynlib_open("/usr/lib/libtiff.so.3");
if (libtiff != NULL) return;
/* OSX has version specific library */
#ifdef __x86_64__
libtiff = PIL_dynlib_open("/usr/lib64/libtiff.so.3");
if (libtiff != NULL) return;
@ -97,6 +124,7 @@ void libtiff_loadlibtiff(void)
if (libtiff != NULL) return;
/* For solaris */
libtiff = PIL_dynlib_open("/usr/openwin/lib/libtiff.so");
#endif
}

@ -57,7 +57,7 @@
#include "IMB_dpxcineon.h"
#include "BKE_global.h"
#if defined(__APPLE__) && defined(GHOST_COCOA)
#if defined(__APPLE__) && defined(IMBUF_COCOA)
#include "IMB_cocoa.h"
#else
#include "IMB_tiff.h"
@ -157,7 +157,7 @@ ImBuf *IMB_ibImageFromMemory(int *mem, int size, int flags) {
ibuf = imb_loadcineon((uchar *)mem, size, flags);
if (ibuf) return(ibuf);
#if defined(__APPLE__) && defined(GHOST_COCOA)
#if defined(__APPLE__) && defined(IMBUF_COCOA)
ibuf = imb_cocoaLoadImage((uchar *)mem, size, flags);
if(ibuf) {
ibuf->ftype = TIF;

@ -53,7 +53,7 @@
#include "IMB_bmp.h"
#include "IMB_radiance_hdr.h"
#if defined(__APPLE__) && defined(GHOST_COCOA)
#if defined(__APPLE__) && defined(IMBUF_COCOA)
#include "IMB_cocoa.h"
#else
#include "IMB_tiff.h"
@ -119,7 +119,7 @@ short IMB_saveiff(struct ImBuf *ibuf, char *name, int flags)
return imb_saveiris(ibuf, name, flags);
}
#if defined(__APPLE__) && defined(GHOST_COCOA)
#if defined(__APPLE__) && defined(IMBUF_COCOA)
if (IS_tiff(ibuf)) {
if(ibuf->rect==NULL && ibuf->rect_float)
IMB_rect_from_float(ibuf);

@ -247,9 +247,7 @@ void WM_exit(bContext *C)
BPY_end_python();
#endif
#if !(defined(__APPLE__) && defined(GHOST_COCOA))
libtiff_exit();
#endif
#ifdef WITH_QUICKTIME
quicktime_exit();

@ -368,10 +368,8 @@ int main(int argc, char **argv)
switch(argv[a][1]) {
case 'a': /* -b was not given, play an animation */
#if !(defined(__APPLE__) && defined(GHOST_COCOA))
/* exception here, see below, it probably needs happens after qt init? */
libtiff_init();
#endif
// XXX playanim(argc-1, argv+1);
exit(0);
@ -540,10 +538,6 @@ int main(int argc, char **argv)
#endif /* WITH_QUICKTIME */
#if defined(__APPLE__) && defined(GHOST_COCOA)
/* libtiff is not used, Cocoa services are used instead for tiff I/O */
G.have_libtiff = 1;
#else
/* dynamically load libtiff, if available */
libtiff_init();
if (!G.have_libtiff && (G.f & G_DEBUG)) {
@ -551,7 +545,6 @@ int main(int argc, char **argv)
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");
}
#endif
/* OK we are ready for it */