From 0b8a75e98214ddf36c5ec607a42cc3b288ec9dc1 Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 25 May 2012 10:58:28 +0800 Subject: [PATCH] fixed #1240: Used dynamic libtiff library for win32. Fixed some warnings. Added tiff test in Texture2dTest. --- HelloWorld/proj.android/build_native.sh | 4 +- cocos2dx/platform/CCImageCommon_cpp.h | 10 +- .../libraries/libtiff.dll.REMOVED.git-id | 1 + .../libraries/libtiff.lib.REMOVED.git-id | 1 - .../third_party/win32/libtiff/tiffconf.h | 10 +- .../third_party/win32/libtiff/tiffio.h | 350 +++++++++--------- tests/tests/Texture2dTest/Texture2dTest.cpp | 50 ++- tests/tests/Texture2dTest/Texture2dTest.h | 7 + 8 files changed, 236 insertions(+), 197 deletions(-) create mode 100644 cocos2dx/platform/third_party/win32/libraries/libtiff.dll.REMOVED.git-id delete mode 100644 cocos2dx/platform/third_party/win32/libraries/libtiff.lib.REMOVED.git-id diff --git a/HelloWorld/proj.android/build_native.sh b/HelloWorld/proj.android/build_native.sh index e997fbb952..bb0c583c6c 100755 --- a/HelloWorld/proj.android/build_native.sh +++ b/HelloWorld/proj.android/build_native.sh @@ -1,6 +1,6 @@ # set params -NDK_ROOT_LOCAL=/cygdrive/d/programe/android/ndk/android-ndk-r7b -COCOS2DX_ROOT_LOCAL=/cygdrive/e/cocos2d-x +NDK_ROOT_LOCAL=/cygdrive/e/android/android-ndk-r8 +COCOS2DX_ROOT_LOCAL=/cygdrive/f/Project/dumganhar/cocos2d-x buildexternalsfromsource= diff --git a/cocos2dx/platform/CCImageCommon_cpp.h b/cocos2dx/platform/CCImageCommon_cpp.h index 822ea7400b..23988876de 100644 --- a/cocos2dx/platform/CCImageCommon_cpp.h +++ b/cocos2dx/platform/CCImageCommon_cpp.h @@ -376,7 +376,9 @@ static tmsize_t _tiffReadProc(thandle_t fd, void* buf, tmsize_t size) mb-=o; p+=o; if (o!=n) + { break; + } } return p; } @@ -399,22 +401,22 @@ static uint64 _tiffSeekProc(thandle_t fd, uint64 off, int whence) if (whence == SEEK_SET) { CC_BREAK_IF(off > isource->size-1); - ret = isource->offset = off; + ret = isource->offset = (uint32)off; } else if (whence == SEEK_CUR) { CC_BREAK_IF(isource->offset + off > isource->size-1); - ret = isource->offset += off; + ret = isource->offset += (uint32)off; } else if (whence == SEEK_END) { CC_BREAK_IF(off > isource->size-1); - ret = isource->offset = isource->size-1 - off; + ret = isource->offset = (uint32)(isource->size-1 - off); } else { CC_BREAK_IF(off > isource->size-1); - ret = isource->offset = off; + ret = isource->offset = (uint32)off; } } while (0); diff --git a/cocos2dx/platform/third_party/win32/libraries/libtiff.dll.REMOVED.git-id b/cocos2dx/platform/third_party/win32/libraries/libtiff.dll.REMOVED.git-id new file mode 100644 index 0000000000..a0993446bb --- /dev/null +++ b/cocos2dx/platform/third_party/win32/libraries/libtiff.dll.REMOVED.git-id @@ -0,0 +1 @@ +b93dbf63b6d3b716e3fa8d261ea7fda90117e4bf \ No newline at end of file diff --git a/cocos2dx/platform/third_party/win32/libraries/libtiff.lib.REMOVED.git-id b/cocos2dx/platform/third_party/win32/libraries/libtiff.lib.REMOVED.git-id deleted file mode 100644 index 0159765153..0000000000 --- a/cocos2dx/platform/third_party/win32/libraries/libtiff.lib.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -1772ef427775e6b45d2eea0e8e0eb9700a5c3d82 \ No newline at end of file diff --git a/cocos2dx/platform/third_party/win32/libtiff/tiffconf.h b/cocos2dx/platform/third_party/win32/libtiff/tiffconf.h index 680f839f1e..8abaeb3b82 100644 --- a/cocos2dx/platform/third_party/win32/libtiff/tiffconf.h +++ b/cocos2dx/platform/third_party/win32/libtiff/tiffconf.h @@ -89,7 +89,7 @@ #define CCITT_SUPPORT 1 /* Support JPEG compression (requires IJG JPEG library) */ -/* #undef JPEG_SUPPORT */ +#define JPEG_SUPPORT 1 /* Support JBIG compression (requires JBIG-KIT library) */ /* #undef JBIG_SUPPORT */ @@ -105,19 +105,19 @@ /* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation fails with unpatched IJG JPEG library) */ -/* #undef OJPEG_SUPPORT */ +#define OJPEG_SUPPORT 1 /* Support Macintosh PackBits algorithm */ #define PACKBITS_SUPPORT 1 /* Support Pixar log-format algorithm (requires Zlib) */ -/* #undef PIXARLOG_SUPPORT */ +#define PIXARLOG_SUPPORT 1 /* Support ThunderScan 4-bit RLE algorithm */ #define THUNDER_SUPPORT 1 /* Support Deflate compression */ -/* #undef ZIP_SUPPORT */ +#define ZIP_SUPPORT 1 /* Support strip chopping (whether or not to convert single-strip uncompressed images to mutiple strips of ~8Kb to reduce memory usage) */ @@ -136,7 +136,7 @@ #define CHECK_JPEG_YCBCR_SUBSAMPLING 1 /* Support MS MDI magic number files as TIFF */ -/* #undef MDI_SUPPORT */ +#define MDI_SUPPORT 1 /* * Feature support definitions. diff --git a/cocos2dx/platform/third_party/win32/libtiff/tiffio.h b/cocos2dx/platform/third_party/win32/libtiff/tiffio.h index 6ca7434311..0c8f9ac5cd 100644 --- a/cocos2dx/platform/third_party/win32/libtiff/tiffio.h +++ b/cocos2dx/platform/third_party/win32/libtiff/tiffio.h @@ -33,6 +33,12 @@ #include "tiff.h" #include "tiffvers.h" +#if defined(LIBTIFF_EXPORTS) +#define TIFF_DLL __declspec(dllexport) +#else /* use a DLL library */ +#define TIFF_DLL __declspec(dllimport) +#endif + /* * TIFF is defined as an incomplete type to hide the * library's internal data structures from clients. @@ -280,30 +286,30 @@ typedef int (*TIFFMapFileProc)(thandle_t, void** base, toff_t* size); typedef void (*TIFFUnmapFileProc)(thandle_t, void* base, toff_t size); typedef void (*TIFFExtendProc)(TIFF*); -extern const char* TIFFGetVersion(void); +TIFF_DLL extern const char* TIFFGetVersion(void); -extern const TIFFCodec* TIFFFindCODEC(uint16); -extern TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod); -extern void TIFFUnRegisterCODEC(TIFFCodec*); -extern int TIFFIsCODECConfigured(uint16); -extern TIFFCodec* TIFFGetConfiguredCODECs(void); +TIFF_DLL extern const TIFFCodec* TIFFFindCODEC(uint16); +TIFF_DLL extern TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod); +TIFF_DLL extern void TIFFUnRegisterCODEC(TIFFCodec*); +TIFF_DLL extern int TIFFIsCODECConfigured(uint16); +TIFF_DLL extern TIFFCodec* TIFFGetConfiguredCODECs(void); /* * Auxiliary functions. */ -extern void* _TIFFmalloc(tmsize_t s); -extern void* _TIFFrealloc(void* p, tmsize_t s); -extern void _TIFFmemset(void* p, int v, tmsize_t c); -extern void _TIFFmemcpy(void* d, const void* s, tmsize_t c); -extern int _TIFFmemcmp(const void* p1, const void* p2, tmsize_t c); -extern void _TIFFfree(void* p); +TIFF_DLL extern void* _TIFFmalloc(tmsize_t s); +TIFF_DLL extern void* _TIFFrealloc(void* p, tmsize_t s); +TIFF_DLL extern void _TIFFmemset(void* p, int v, tmsize_t c); +TIFF_DLL extern void _TIFFmemcpy(void* d, const void* s, tmsize_t c); +TIFF_DLL extern int _TIFFmemcmp(const void* p1, const void* p2, tmsize_t c); +TIFF_DLL extern void _TIFFfree(void* p); /* ** Stuff, related to tag handling and creating custom tags. */ -extern int TIFFGetTagListCount( TIFF * ); -extern uint32 TIFFGetTagListEntry( TIFF *, int tag_index ); +TIFF_DLL extern int TIFFGetTagListCount( TIFF * ); +TIFF_DLL extern uint32 TIFFGetTagListEntry( TIFF *, int tag_index ); #define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */ #define TIFF_VARIABLE -1 /* marker for variable length tags */ @@ -315,9 +321,9 @@ extern uint32 TIFFGetTagListEntry( TIFF *, int tag_index ); typedef struct _TIFFField TIFFField; typedef struct _TIFFFieldArray TIFFFieldArray; -extern const TIFFField* TIFFFindField(TIFF *, uint32, TIFFDataType); -extern const TIFFField* TIFFFieldWithTag(TIFF*, uint32); -extern const TIFFField* TIFFFieldWithName(TIFF*, const char *); +TIFF_DLL extern const TIFFField* TIFFFindField(TIFF *, uint32, TIFFDataType); +TIFF_DLL extern const TIFFField* TIFFFieldWithTag(TIFF*, uint32); +TIFF_DLL extern const TIFFField* TIFFFieldWithName(TIFF*, const char *); typedef int (*TIFFVSetMethod)(TIFF*, uint32, va_list); typedef int (*TIFFVGetMethod)(TIFF*, uint32, va_list); @@ -329,187 +335,187 @@ typedef struct { TIFFPrintMethod printdir; /* directory print routine */ } TIFFTagMethods; -extern TIFFTagMethods *TIFFAccessTagMethods(TIFF *); -extern void *TIFFGetClientInfo(TIFF *, const char *); -extern void TIFFSetClientInfo(TIFF *, void *, const char *); +TIFF_DLL extern TIFFTagMethods *TIFFAccessTagMethods(TIFF *); +TIFF_DLL extern void *TIFFGetClientInfo(TIFF *, const char *); +TIFF_DLL extern void TIFFSetClientInfo(TIFF *, void *, const char *); -extern void TIFFCleanup(TIFF* tif); -extern void TIFFClose(TIFF* tif); -extern int TIFFFlush(TIFF* tif); -extern int TIFFFlushData(TIFF* tif); -extern int TIFFGetField(TIFF* tif, uint32 tag, ...); -extern int TIFFVGetField(TIFF* tif, uint32 tag, va_list ap); -extern int TIFFGetFieldDefaulted(TIFF* tif, uint32 tag, ...); -extern int TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap); -extern int TIFFReadDirectory(TIFF* tif); -extern int TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, const TIFFFieldArray* infoarray); -extern int TIFFReadEXIFDirectory(TIFF* tif, toff_t diroff); -extern uint64 TIFFScanlineSize64(TIFF* tif); -extern tmsize_t TIFFScanlineSize(TIFF* tif); -extern uint64 TIFFRasterScanlineSize64(TIFF* tif); -extern tmsize_t TIFFRasterScanlineSize(TIFF* tif); -extern uint64 TIFFStripSize64(TIFF* tif); -extern tmsize_t TIFFStripSize(TIFF* tif); -extern uint64 TIFFRawStripSize64(TIFF* tif, uint32 strip); -extern tmsize_t TIFFRawStripSize(TIFF* tif, uint32 strip); -extern uint64 TIFFVStripSize64(TIFF* tif, uint32 nrows); -extern tmsize_t TIFFVStripSize(TIFF* tif, uint32 nrows); -extern uint64 TIFFTileRowSize64(TIFF* tif); -extern tmsize_t TIFFTileRowSize(TIFF* tif); -extern uint64 TIFFTileSize64(TIFF* tif); -extern tmsize_t TIFFTileSize(TIFF* tif); -extern uint64 TIFFVTileSize64(TIFF* tif, uint32 nrows); -extern tmsize_t TIFFVTileSize(TIFF* tif, uint32 nrows); -extern uint32 TIFFDefaultStripSize(TIFF* tif, uint32 request); -extern void TIFFDefaultTileSize(TIFF*, uint32*, uint32*); -extern int TIFFFileno(TIFF*); -extern int TIFFSetFileno(TIFF*, int); -extern thandle_t TIFFClientdata(TIFF*); -extern thandle_t TIFFSetClientdata(TIFF*, thandle_t); -extern int TIFFGetMode(TIFF*); -extern int TIFFSetMode(TIFF*, int); -extern int TIFFIsTiled(TIFF*); -extern int TIFFIsByteSwapped(TIFF*); -extern int TIFFIsUpSampled(TIFF*); -extern int TIFFIsMSB2LSB(TIFF*); -extern int TIFFIsBigEndian(TIFF*); -extern TIFFReadWriteProc TIFFGetReadProc(TIFF*); -extern TIFFReadWriteProc TIFFGetWriteProc(TIFF*); -extern TIFFSeekProc TIFFGetSeekProc(TIFF*); -extern TIFFCloseProc TIFFGetCloseProc(TIFF*); -extern TIFFSizeProc TIFFGetSizeProc(TIFF*); -extern TIFFMapFileProc TIFFGetMapFileProc(TIFF*); -extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*); -extern uint32 TIFFCurrentRow(TIFF*); -extern uint16 TIFFCurrentDirectory(TIFF*); -extern uint16 TIFFNumberOfDirectories(TIFF*); -extern uint64 TIFFCurrentDirOffset(TIFF*); -extern uint32 TIFFCurrentStrip(TIFF*); -extern uint32 TIFFCurrentTile(TIFF* tif); -extern int TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size); -extern int TIFFWriteBufferSetup(TIFF* tif, void* bp, tmsize_t size); -extern int TIFFSetupStrips(TIFF *); -extern int TIFFWriteCheck(TIFF*, int, const char *); -extern void TIFFFreeDirectory(TIFF*); -extern int TIFFCreateDirectory(TIFF*); -extern int TIFFLastDirectory(TIFF*); -extern int TIFFSetDirectory(TIFF*, uint16); -extern int TIFFSetSubDirectory(TIFF*, uint64); -extern int TIFFUnlinkDirectory(TIFF*, uint16); -extern int TIFFSetField(TIFF*, uint32, ...); -extern int TIFFVSetField(TIFF*, uint32, va_list); -extern int TIFFUnsetField(TIFF*, uint32); -extern int TIFFWriteDirectory(TIFF *); -extern int TIFFCheckpointDirectory(TIFF *); -extern int TIFFRewriteDirectory(TIFF *); +TIFF_DLL extern void TIFFCleanup(TIFF* tif); +TIFF_DLL extern void TIFFClose(TIFF* tif); +TIFF_DLL extern int TIFFFlush(TIFF* tif); +TIFF_DLL extern int TIFFFlushData(TIFF* tif); +TIFF_DLL extern int TIFFGetField(TIFF* tif, uint32 tag, ...); +TIFF_DLL extern int TIFFVGetField(TIFF* tif, uint32 tag, va_list ap); +TIFF_DLL extern int TIFFGetFieldDefaulted(TIFF* tif, uint32 tag, ...); +TIFF_DLL extern int TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap); +TIFF_DLL extern int TIFFReadDirectory(TIFF* tif); +TIFF_DLL extern int TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, const TIFFFieldArray* infoarray); +TIFF_DLL extern int TIFFReadEXIFDirectory(TIFF* tif, toff_t diroff); +TIFF_DLL extern uint64 TIFFScanlineSize64(TIFF* tif); +TIFF_DLL extern tmsize_t TIFFScanlineSize(TIFF* tif); +TIFF_DLL extern uint64 TIFFRasterScanlineSize64(TIFF* tif); +TIFF_DLL extern tmsize_t TIFFRasterScanlineSize(TIFF* tif); +TIFF_DLL extern uint64 TIFFStripSize64(TIFF* tif); +TIFF_DLL extern tmsize_t TIFFStripSize(TIFF* tif); +TIFF_DLL extern uint64 TIFFRawStripSize64(TIFF* tif, uint32 strip); +TIFF_DLL extern tmsize_t TIFFRawStripSize(TIFF* tif, uint32 strip); +TIFF_DLL extern uint64 TIFFVStripSize64(TIFF* tif, uint32 nrows); +TIFF_DLL extern tmsize_t TIFFVStripSize(TIFF* tif, uint32 nrows); +TIFF_DLL extern uint64 TIFFTileRowSize64(TIFF* tif); +TIFF_DLL extern tmsize_t TIFFTileRowSize(TIFF* tif); +TIFF_DLL extern uint64 TIFFTileSize64(TIFF* tif); +TIFF_DLL extern tmsize_t TIFFTileSize(TIFF* tif); +TIFF_DLL extern uint64 TIFFVTileSize64(TIFF* tif, uint32 nrows); +TIFF_DLL extern tmsize_t TIFFVTileSize(TIFF* tif, uint32 nrows); +TIFF_DLL extern uint32 TIFFDefaultStripSize(TIFF* tif, uint32 request); +TIFF_DLL extern void TIFFDefaultTileSize(TIFF*, uint32*, uint32*); +TIFF_DLL extern int TIFFFileno(TIFF*); +TIFF_DLL extern int TIFFSetFileno(TIFF*, int); +TIFF_DLL extern thandle_t TIFFClientdata(TIFF*); +TIFF_DLL extern thandle_t TIFFSetClientdata(TIFF*, thandle_t); +TIFF_DLL extern int TIFFGetMode(TIFF*); +TIFF_DLL extern int TIFFSetMode(TIFF*, int); +TIFF_DLL extern int TIFFIsTiled(TIFF*); +TIFF_DLL extern int TIFFIsByteSwapped(TIFF*); +TIFF_DLL extern int TIFFIsUpSampled(TIFF*); +TIFF_DLL extern int TIFFIsMSB2LSB(TIFF*); +TIFF_DLL extern int TIFFIsBigEndian(TIFF*); +TIFF_DLL extern TIFFReadWriteProc TIFFGetReadProc(TIFF*); +TIFF_DLL extern TIFFReadWriteProc TIFFGetWriteProc(TIFF*); +TIFF_DLL extern TIFFSeekProc TIFFGetSeekProc(TIFF*); +TIFF_DLL extern TIFFCloseProc TIFFGetCloseProc(TIFF*); +TIFF_DLL extern TIFFSizeProc TIFFGetSizeProc(TIFF*); +TIFF_DLL extern TIFFMapFileProc TIFFGetMapFileProc(TIFF*); +TIFF_DLL extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*); +TIFF_DLL extern uint32 TIFFCurrentRow(TIFF*); +TIFF_DLL extern uint16 TIFFCurrentDirectory(TIFF*); +TIFF_DLL extern uint16 TIFFNumberOfDirectories(TIFF*); +TIFF_DLL extern uint64 TIFFCurrentDirOffset(TIFF*); +TIFF_DLL extern uint32 TIFFCurrentStrip(TIFF*); +TIFF_DLL extern uint32 TIFFCurrentTile(TIFF* tif); +TIFF_DLL extern int TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size); +TIFF_DLL extern int TIFFWriteBufferSetup(TIFF* tif, void* bp, tmsize_t size); +TIFF_DLL extern int TIFFSetupStrips(TIFF *); +TIFF_DLL extern int TIFFWriteCheck(TIFF*, int, const char *); +TIFF_DLL extern void TIFFFreeDirectory(TIFF*); +TIFF_DLL extern int TIFFCreateDirectory(TIFF*); +TIFF_DLL extern int TIFFLastDirectory(TIFF*); +TIFF_DLL extern int TIFFSetDirectory(TIFF*, uint16); +TIFF_DLL extern int TIFFSetSubDirectory(TIFF*, uint64); +TIFF_DLL extern int TIFFUnlinkDirectory(TIFF*, uint16); +TIFF_DLL extern int TIFFSetField(TIFF*, uint32, ...); +TIFF_DLL extern int TIFFVSetField(TIFF*, uint32, va_list); +TIFF_DLL extern int TIFFUnsetField(TIFF*, uint32); +TIFF_DLL extern int TIFFWriteDirectory(TIFF *); +TIFF_DLL extern int TIFFCheckpointDirectory(TIFF *); +TIFF_DLL extern int TIFFRewriteDirectory(TIFF *); #if defined(c_plusplus) || defined(__cplusplus) -extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0); -extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0); -extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0); -extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0); -extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, +TIFF_DLL extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0); +TIFF_DLL extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0); +TIFF_DLL extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0); +TIFF_DLL extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0); +TIFF_DLL extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int = ORIENTATION_BOTLEFT, int = 0); #else -extern void TIFFPrintDirectory(TIFF*, FILE*, long); -extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample); -extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample); -extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int); -extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int); +TIFF_DLL extern void TIFFPrintDirectory(TIFF*, FILE*, long); +TIFF_DLL extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample); +TIFF_DLL extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample); +TIFF_DLL extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int); +TIFF_DLL extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int); #endif -extern int TIFFReadRGBAStrip(TIFF*, uint32, uint32 * ); -extern int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * ); -extern int TIFFRGBAImageOK(TIFF*, char [1024]); -extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]); -extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32); -extern void TIFFRGBAImageEnd(TIFFRGBAImage*); -extern TIFF* TIFFOpen(const char*, const char*); +TIFF_DLL extern int TIFFReadRGBAStrip(TIFF*, uint32, uint32 * ); +TIFF_DLL extern int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * ); +TIFF_DLL extern int TIFFRGBAImageOK(TIFF*, char [1024]); +TIFF_DLL extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]); +TIFF_DLL extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32); +TIFF_DLL extern void TIFFRGBAImageEnd(TIFFRGBAImage*); +TIFF_DLL extern TIFF* TIFFOpen(const char*, const char*); # ifdef __WIN32__ -extern TIFF* TIFFOpenW(const wchar_t*, const char*); +TIFF_DLL extern TIFF* TIFFOpenW(const wchar_t*, const char*); # endif /* __WIN32__ */ -extern TIFF* TIFFFdOpen(int, const char*, const char*); -extern TIFF* TIFFClientOpen(const char*, const char*, +TIFF_DLL extern TIFF* TIFFFdOpen(int, const char*, const char*); +TIFF_DLL extern TIFF* TIFFClientOpen(const char*, const char*, thandle_t, TIFFReadWriteProc, TIFFReadWriteProc, TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, TIFFMapFileProc, TIFFUnmapFileProc); -extern const char* TIFFFileName(TIFF*); -extern const char* TIFFSetFileName(TIFF*, const char *); -extern void TIFFError(const char*, const char*, ...) __attribute__((__format__ (__printf__,2,3))); -extern void TIFFErrorExt(thandle_t, const char*, const char*, ...) __attribute__((__format__ (__printf__,3,4))); -extern void TIFFWarning(const char*, const char*, ...) __attribute__((__format__ (__printf__,2,3))); -extern void TIFFWarningExt(thandle_t, const char*, const char*, ...) __attribute__((__format__ (__printf__,3,4))); -extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler); -extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt); -extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler); -extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt); -extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc); -extern uint32 TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s); -extern int TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s); -extern uint32 TIFFNumberOfTiles(TIFF*); -extern tmsize_t TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s); -extern tmsize_t TIFFWriteTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s); -extern uint32 TIFFComputeStrip(TIFF*, uint32, uint16); -extern uint32 TIFFNumberOfStrips(TIFF*); -extern tmsize_t TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size); -extern tmsize_t TIFFReadRawStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size); -extern tmsize_t TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size); -extern tmsize_t TIFFReadRawTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size); -extern tmsize_t TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc); -extern tmsize_t TIFFWriteRawStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc); -extern tmsize_t TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc); -extern tmsize_t TIFFWriteRawTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc); -extern int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */ -extern void TIFFSetWriteOffset(TIFF* tif, toff_t off); -extern void TIFFSwabShort(uint16*); -extern void TIFFSwabLong(uint32*); -extern void TIFFSwabLong8(uint64*); -extern void TIFFSwabFloat(float*); -extern void TIFFSwabDouble(double*); -extern void TIFFSwabArrayOfShort(uint16* wp, tmsize_t n); -extern void TIFFSwabArrayOfTriples(uint8* tp, tmsize_t n); -extern void TIFFSwabArrayOfLong(uint32* lp, tmsize_t n); -extern void TIFFSwabArrayOfLong8(uint64* lp, tmsize_t n); -extern void TIFFSwabArrayOfFloat(float* fp, tmsize_t n); -extern void TIFFSwabArrayOfDouble(double* dp, tmsize_t n); -extern void TIFFReverseBits(uint8* cp, tmsize_t n); -extern const unsigned char* TIFFGetBitRevTable(int); +TIFF_DLL extern const char* TIFFFileName(TIFF*); +TIFF_DLL extern const char* TIFFSetFileName(TIFF*, const char *); +TIFF_DLL extern void TIFFError(const char*, const char*, ...) __attribute__((__format__ (__printf__,2,3))); +TIFF_DLL extern void TIFFErrorExt(thandle_t, const char*, const char*, ...) __attribute__((__format__ (__printf__,3,4))); +TIFF_DLL extern void TIFFWarning(const char*, const char*, ...) __attribute__((__format__ (__printf__,2,3))); +TIFF_DLL extern void TIFFWarningExt(thandle_t, const char*, const char*, ...) __attribute__((__format__ (__printf__,3,4))); +TIFF_DLL extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler); +TIFF_DLL extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt); +TIFF_DLL extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler); +TIFF_DLL extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt); +TIFF_DLL extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc); +TIFF_DLL extern uint32 TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s); +TIFF_DLL extern int TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s); +TIFF_DLL extern uint32 TIFFNumberOfTiles(TIFF*); +TIFF_DLL extern tmsize_t TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s); +TIFF_DLL extern tmsize_t TIFFWriteTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s); +TIFF_DLL extern uint32 TIFFComputeStrip(TIFF*, uint32, uint16); +TIFF_DLL extern uint32 TIFFNumberOfStrips(TIFF*); +TIFF_DLL extern tmsize_t TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size); +TIFF_DLL extern tmsize_t TIFFReadRawStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size); +TIFF_DLL extern tmsize_t TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size); +TIFF_DLL extern tmsize_t TIFFReadRawTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size); +TIFF_DLL extern tmsize_t TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc); +TIFF_DLL extern tmsize_t TIFFWriteRawStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc); +TIFF_DLL extern tmsize_t TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc); +TIFF_DLL extern tmsize_t TIFFWriteRawTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc); +TIFF_DLL extern int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */ +TIFF_DLL extern void TIFFSetWriteOffset(TIFF* tif, toff_t off); +TIFF_DLL extern void TIFFSwabShort(uint16*); +TIFF_DLL extern void TIFFSwabLong(uint32*); +TIFF_DLL extern void TIFFSwabLong8(uint64*); +TIFF_DLL extern void TIFFSwabFloat(float*); +TIFF_DLL extern void TIFFSwabDouble(double*); +TIFF_DLL extern void TIFFSwabArrayOfShort(uint16* wp, tmsize_t n); +TIFF_DLL extern void TIFFSwabArrayOfTriples(uint8* tp, tmsize_t n); +TIFF_DLL extern void TIFFSwabArrayOfLong(uint32* lp, tmsize_t n); +TIFF_DLL extern void TIFFSwabArrayOfLong8(uint64* lp, tmsize_t n); +TIFF_DLL extern void TIFFSwabArrayOfFloat(float* fp, tmsize_t n); +TIFF_DLL extern void TIFFSwabArrayOfDouble(double* dp, tmsize_t n); +TIFF_DLL extern void TIFFReverseBits(uint8* cp, tmsize_t n); +TIFF_DLL extern const unsigned char* TIFFGetBitRevTable(int); #ifdef LOGLUV_PUBLIC #define U_NEU 0.210526316 #define V_NEU 0.473684211 #define UVSCALE 410. -extern double LogL16toY(int); -extern double LogL10toY(int); -extern void XYZtoRGB24(float*, uint8*); -extern int uv_decode(double*, double*, int); -extern void LogLuv24toXYZ(uint32, float*); -extern void LogLuv32toXYZ(uint32, float*); +TIFF_DLL extern double LogL16toY(int); +TIFF_DLL extern double LogL10toY(int); +TIFF_DLL extern void XYZtoRGB24(float*, uint8*); +TIFF_DLL extern int uv_decode(double*, double*, int); +TIFF_DLL extern void LogLuv24toXYZ(uint32, float*); +TIFF_DLL extern void LogLuv32toXYZ(uint32, float*); #if defined(c_plusplus) || defined(__cplusplus) -extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER); -extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER); -extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER); -extern uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER); -extern uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER); +TIFF_DLL extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER); +TIFF_DLL extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER); +TIFF_DLL extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER); +TIFF_DLL extern uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER); +TIFF_DLL extern uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER); #else -extern int LogL16fromY(double, int); -extern int LogL10fromY(double, int); -extern int uv_encode(double, double, int); -extern uint32 LogLuv24fromXYZ(float*, int); -extern uint32 LogLuv32fromXYZ(float*, int); +TIFF_DLL extern int LogL16fromY(double, int); +TIFF_DLL extern int LogL10fromY(double, int); +TIFF_DLL extern int uv_encode(double, double, int); +TIFF_DLL extern uint32 LogLuv24fromXYZ(float*, int); +TIFF_DLL extern uint32 LogLuv32fromXYZ(float*, int); #endif #endif /* LOGLUV_PUBLIC */ -extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, const TIFFDisplay *, float*); -extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32, +TIFF_DLL extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, const TIFFDisplay *, float*); +TIFF_DLL extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32, float *, float *, float *); -extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float, +TIFF_DLL extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float, uint32 *, uint32 *, uint32 *); -extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*); -extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32, +TIFF_DLL extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*); +TIFF_DLL extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32, uint32 *, uint32 *, uint32 *); /**************************************************************************** @@ -529,7 +535,7 @@ typedef struct { char *field_name; /* ASCII name */ } TIFFFieldInfo; -extern int TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], uint32); +TIFF_DLL extern int TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], uint32); #if defined(c_plusplus) || defined(__cplusplus) } diff --git a/tests/tests/Texture2dTest/Texture2dTest.cpp b/tests/tests/Texture2dTest/Texture2dTest.cpp index c9f656b267..a26be88810 100644 --- a/tests/tests/Texture2dTest/Texture2dTest.cpp +++ b/tests/tests/Texture2dTest/Texture2dTest.cpp @@ -8,7 +8,7 @@ enum { kTagSprite2 = 3, }; -#define TEST_CASE_COUNT 34 +#define TEST_CASE_COUNT 35 static int sceneIdx=-1; CCLayer* createTextureTest(int index) @@ -60,30 +60,32 @@ CCLayer* createTextureTest(int index) case 20: pLayer = new TexturePVRBadEncoding(); break; case 21: - pLayer = new TexturePNG(); break; + pLayer = new TextureTIFF(); break; case 22: - pLayer = new TextureJPEG(); break; + pLayer = new TexturePNG(); break; case 23: - pLayer = new TexturePixelFormat(); break; + pLayer = new TextureJPEG(); break; case 24: - pLayer = new TextureBlend(); break; + pLayer = new TexturePixelFormat(); break; case 25: - pLayer = new TextureGlClamp(); break; + pLayer = new TextureBlend(); break; case 26: - pLayer = new TextureGlRepeat(); break; + pLayer = new TextureGlClamp(); break; case 27: - pLayer = new TextureSizeTest(); break; + pLayer = new TextureGlRepeat(); break; case 28: - pLayer = new TextureCache1(); break; + pLayer = new TextureSizeTest(); break; case 29: - pLayer = new TexturePVRRGB888(); break; + pLayer = new TextureCache1(); break; case 30: - pLayer = new TextureAsync(); break; + pLayer = new TexturePVRRGB888(); break; case 31: - pLayer = new TextureDrawAtPoint(); break; + pLayer = new TextureAsync(); break; case 32: - pLayer = new TextureDrawInRect(); break; + pLayer = new TextureDrawAtPoint(); break; case 33: + pLayer = new TextureDrawInRect(); break; + case 34: pLayer = new FileUtilsTest(); break; default: break; @@ -199,6 +201,28 @@ std::string TextureDemo::subtitle() return ""; } +//------------------------------------------------------------------ +// +// TextureTIFF +// +//------------------------------------------------------------------ + +void TextureTIFF::onEnter() +{ + TextureDemo::onEnter(); + CCSize s = CCDirector::sharedDirector()->getWinSize(); + + CCSprite *img = CCSprite::spriteWithFile("Images/test_image.tiff"); + img->setPosition(ccp( s.width/2.0f, s.height/2.0f)); + this->addChild(img); + CCTextureCache::sharedTextureCache()->dumpCachedTextureInfo(); +} + +std::string TextureTIFF::title() +{ + return "TIFF Test"; +} + //------------------------------------------------------------------ // // TexturePNG diff --git a/tests/tests/Texture2dTest/Texture2dTest.h b/tests/tests/Texture2dTest/Texture2dTest.h index c73ea62655..3e30455cd5 100644 --- a/tests/tests/Texture2dTest/Texture2dTest.h +++ b/tests/tests/Texture2dTest/Texture2dTest.h @@ -17,6 +17,13 @@ public: void backCallback(CCObject* pSender); }; +class TextureTIFF : public TextureDemo +{ +public: + virtual std::string title(); + virtual void onEnter(); +}; + class TexturePNG : public TextureDemo { public: