windowscodecs: Use the bundled libtiff.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
913dad521f
commit
d36615ee52
|
@ -639,8 +639,6 @@ NETAPI_CFLAGS
|
|||
PROCSTAT_LIBS
|
||||
MPG123_LIBS
|
||||
MPG123_CFLAGS
|
||||
TIFF_LIBS
|
||||
TIFF_CFLAGS
|
||||
JXRLIB_LIBS
|
||||
JXRLIB_CFLAGS
|
||||
JPEG_LIBS
|
||||
|
@ -888,7 +886,6 @@ with_pulse
|
|||
with_quicktime
|
||||
with_sane
|
||||
with_sdl
|
||||
with_tiff
|
||||
with_udev
|
||||
with_unwind
|
||||
with_usb
|
||||
|
@ -1986,8 +1983,6 @@ JPEG_CFLAGS
|
|||
JPEG_LIBS
|
||||
JXRLIB_CFLAGS
|
||||
JXRLIB_LIBS
|
||||
TIFF_CFLAGS
|
||||
TIFF_LIBS
|
||||
MPG123_CFLAGS
|
||||
MPG123_LIBS
|
||||
NETAPI_CFLAGS
|
||||
|
@ -2677,7 +2672,6 @@ Optional Packages:
|
|||
--without-quicktime do not use QuickTime support
|
||||
--without-sane do not use SANE (scanner support)
|
||||
--without-sdl do not use SDL
|
||||
--without-tiff do not use TIFF
|
||||
--without-udev do not use udev (plug and play support)
|
||||
--without-unwind do not use the libunwind library (exception
|
||||
handling)
|
||||
|
@ -2804,8 +2798,6 @@ Some influential environment variables:
|
|||
JXRLIB_CFLAGS
|
||||
C compiler flags for jxrlib, overriding pkg-config
|
||||
JXRLIB_LIBS Linker flags for jxrlib, overriding pkg-config
|
||||
TIFF_CFLAGS C compiler flags for libtiff-4, overriding pkg-config
|
||||
TIFF_LIBS Linker flags for libtiff-4, overriding pkg-config
|
||||
MPG123_CFLAGS
|
||||
C compiler flags for libmpg123, overriding pkg-config
|
||||
MPG123_LIBS Linker flags for libmpg123, overriding pkg-config
|
||||
|
@ -4217,12 +4209,6 @@ if test "${with_sdl+set}" = set; then :
|
|||
fi
|
||||
|
||||
|
||||
# Check whether --with-tiff was given.
|
||||
if test "${with_tiff+set}" = set; then :
|
||||
withval=$with_tiff;
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --with-udev was given.
|
||||
if test "${with_udev+set}" = set; then :
|
||||
withval=$with_udev;
|
||||
|
@ -16053,108 +16039,6 @@ esac
|
|||
|
||||
fi
|
||||
|
||||
if test "x$with_tiff" != "xno"
|
||||
then
|
||||
if ${TIFF_CFLAGS:+false} :; then :
|
||||
if ${PKG_CONFIG+:} false; then :
|
||||
TIFF_CFLAGS=`$PKG_CONFIG --cflags libtiff-4 2>/dev/null`
|
||||
fi
|
||||
fi
|
||||
|
||||
if ${TIFF_LIBS:+false} :; then :
|
||||
if ${PKG_CONFIG+:} false; then :
|
||||
TIFF_LIBS=`$PKG_CONFIG --libs libtiff-4 2>/dev/null`
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: libtiff-4 cflags: $TIFF_CFLAGS" >&5
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: libtiff-4 libs: $TIFF_LIBS" >&5
|
||||
ac_save_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $TIFF_CFLAGS"
|
||||
for ac_header in tiffio.h
|
||||
do :
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "tiffio.h" "ac_cv_header_tiffio_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_tiffio_h" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_TIFFIO_H 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
if test "$ac_cv_header_tiffio_h" = "yes"
|
||||
then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -ltiff" >&5
|
||||
$as_echo_n "checking for -ltiff... " >&6; }
|
||||
if ${ac_cv_lib_soname_tiff+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
ac_check_soname_save_LIBS=$LIBS
|
||||
LIBS="-ltiff $TIFF_LIBS $LIBS"
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char TIFFClientOpen ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return TIFFClientOpen ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_link "$LINENO"; then :
|
||||
case "$LIBEXT" in
|
||||
dll) ac_cv_lib_soname_tiff=`$ac_cv_path_LDD conftest.exe | grep "tiff" | sed -e "s/dll.*/dll/"';2,$d'` ;;
|
||||
dylib) ac_cv_lib_soname_tiff=`$OTOOL -L conftest$ac_exeext | grep "libtiff\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libtiff\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;;
|
||||
*) ac_cv_lib_soname_tiff=`$READELF -d conftest$ac_exeext | grep "NEEDED.*libtiff\\.$LIBEXT" | sed -e "s/^.*\\[\\(libtiff\\.$LIBEXT[^ ]*\\)\\].*$/\1/"';2,$d'`
|
||||
if ${ac_cv_lib_soname_tiff:+false} :; then :
|
||||
ac_cv_lib_soname_tiff=`$LDD conftest$ac_exeext | grep "libtiff\\.$LIBEXT" | sed -e "s/^.*\(libtiff\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'`
|
||||
fi ;;
|
||||
esac
|
||||
else
|
||||
ac_cv_lib_soname_tiff=
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_soname_save_LIBS
|
||||
fi
|
||||
if ${ac_cv_lib_soname_tiff:+false} :; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
|
||||
$as_echo "not found" >&6; }
|
||||
|
||||
else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_soname_tiff" >&5
|
||||
$as_echo "$ac_cv_lib_soname_tiff" >&6; }
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define SONAME_LIBTIFF "$ac_cv_lib_soname_tiff"
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
fi
|
||||
CPPFLAGS=$ac_save_CPPFLAGS
|
||||
|
||||
fi
|
||||
if test "x$ac_cv_lib_soname_tiff" = "x"; then :
|
||||
case "x$with_tiff" in
|
||||
x) as_fn_append wine_notices "|libtiff ${notice_platform}development files not found, TIFF won't be supported." ;;
|
||||
xno) ;;
|
||||
*) as_fn_error $? "libtiff ${notice_platform}development files not found, TIFF won't be supported.
|
||||
This is an error since --with-tiff was requested." "$LINENO" 5 ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
|
||||
if test "x$with_mpg123" != "xno"
|
||||
then
|
||||
if ${MPG123_CFLAGS:+false} :; then :
|
||||
|
@ -19670,8 +19554,6 @@ JPEG_CFLAGS = $JPEG_CFLAGS
|
|||
JPEG_LIBS = $JPEG_LIBS
|
||||
JXRLIB_CFLAGS = $JXRLIB_CFLAGS
|
||||
JXRLIB_LIBS = $JXRLIB_LIBS
|
||||
TIFF_CFLAGS = $TIFF_CFLAGS
|
||||
TIFF_LIBS = $TIFF_LIBS
|
||||
MPG123_CFLAGS = $MPG123_CFLAGS
|
||||
MPG123_LIBS = $MPG123_LIBS
|
||||
PROCSTAT_LIBS = $PROCSTAT_LIBS
|
||||
|
|
14
configure.ac
14
configure.ac
|
@ -81,7 +81,6 @@ AC_ARG_WITH(pulse, AS_HELP_STRING([--without-pulse],[do not use PulseAudio s
|
|||
AC_ARG_WITH(quicktime, AS_HELP_STRING([--without-quicktime],[do not use QuickTime support]))
|
||||
AC_ARG_WITH(sane, AS_HELP_STRING([--without-sane],[do not use SANE (scanner support)]))
|
||||
AC_ARG_WITH(sdl, AS_HELP_STRING([--without-sdl],[do not use SDL]))
|
||||
AC_ARG_WITH(tiff, AS_HELP_STRING([--without-tiff],[do not use TIFF]))
|
||||
AC_ARG_WITH(udev, AS_HELP_STRING([--without-udev],[do not use udev (plug and play support)]))
|
||||
AC_ARG_WITH(unwind, AS_HELP_STRING([--without-unwind],[do not use the libunwind library (exception handling)]))
|
||||
AC_ARG_WITH(usb, AS_HELP_STRING([--without-usb],[do not use the libusb library]))
|
||||
|
@ -1814,19 +1813,6 @@ fi
|
|||
WINE_NOTICE_WITH(jxrlib,[test "x$ac_cv_lib_soname_jxrglue" = "x"],
|
||||
[jxrlib ${notice_platform}development files not found, JPEG-XR won't be supported.])
|
||||
|
||||
dnl **** Check for libtiff ****
|
||||
if test "x$with_tiff" != "xno"
|
||||
then
|
||||
WINE_PACKAGE_FLAGS(TIFF,[libtiff-4],,,,
|
||||
[AC_CHECK_HEADERS([tiffio.h])
|
||||
if test "$ac_cv_header_tiffio_h" = "yes"
|
||||
then
|
||||
WINE_CHECK_SONAME(tiff,TIFFClientOpen,,,[$TIFF_LIBS])
|
||||
fi])
|
||||
fi
|
||||
WINE_NOTICE_WITH(tiff,[test "x$ac_cv_lib_soname_tiff" = "x"],
|
||||
[libtiff ${notice_platform}development files not found, TIFF won't be supported.])
|
||||
|
||||
dnl **** Check for mpg123 ****
|
||||
if test "x$with_mpg123" != "xno"
|
||||
then
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
MODULE = windowscodecs.dll
|
||||
IMPORTLIB = windowscodecs
|
||||
IMPORTS = $(JPEG_PE_LIBS) $(PNG_PE_LIBS) windowscodecs uuid ole32 oleaut32 propsys rpcrt4 shlwapi user32 gdi32 advapi32
|
||||
EXTRAINCL = $(JPEG_PE_CFLAGS) $(PNG_PE_CFLAGS) $(TIFF_CFLAGS)
|
||||
IMPORTS = $(TIFF_PE_LIBS) $(JPEG_PE_LIBS) $(PNG_PE_LIBS) windowscodecs uuid ole32 oleaut32 propsys rpcrt4 shlwapi user32 gdi32 advapi32
|
||||
EXTRAINCL = $(TIFF_PE_CFLAGS) $(JPEG_PE_CFLAGS) $(PNG_PE_CFLAGS)
|
||||
EXTRALIBS = $(APPLICATIONSERVICES_LIBS)
|
||||
|
||||
C_SRCS = \
|
||||
|
|
|
@ -17,22 +17,10 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#pragma makedep unix
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <math.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_TIFFIO_H
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <tiffio.h>
|
||||
#endif
|
||||
|
||||
#include "ntstatus.h"
|
||||
#define WIN32_NO_STATUS
|
||||
|
@ -47,91 +35,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
|
||||
|
||||
#ifdef SONAME_LIBTIFF
|
||||
|
||||
/* Workaround for broken libtiff 4.x headers on some 64-bit hosts which
|
||||
* define TIFF_UINT64_T/toff_t as 32-bit for 32-bit builds, while they
|
||||
* are supposed to be always 64-bit.
|
||||
* TIFF_UINT64_T doesn't exist in libtiff 3.x, it was introduced in 4.x.
|
||||
*/
|
||||
#ifdef TIFF_UINT64_T
|
||||
# undef toff_t
|
||||
# define toff_t UINT64
|
||||
#endif
|
||||
|
||||
static CRITICAL_SECTION init_tiff_cs;
|
||||
static CRITICAL_SECTION_DEBUG init_tiff_cs_debug =
|
||||
{
|
||||
0, 0, &init_tiff_cs,
|
||||
{ &init_tiff_cs_debug.ProcessLocksList,
|
||||
&init_tiff_cs_debug.ProcessLocksList },
|
||||
0, 0, { (DWORD_PTR)(__FILE__ ": init_tiff_cs") }
|
||||
};
|
||||
static CRITICAL_SECTION init_tiff_cs = { &init_tiff_cs_debug, -1, 0, 0, 0, 0 };
|
||||
|
||||
static void *libtiff_handle;
|
||||
#define MAKE_FUNCPTR(f) static typeof(f) * p##f
|
||||
MAKE_FUNCPTR(TIFFClientOpen);
|
||||
MAKE_FUNCPTR(TIFFClose);
|
||||
MAKE_FUNCPTR(TIFFCurrentDirOffset);
|
||||
MAKE_FUNCPTR(TIFFGetField);
|
||||
MAKE_FUNCPTR(TIFFIsByteSwapped);
|
||||
MAKE_FUNCPTR(TIFFNumberOfDirectories);
|
||||
MAKE_FUNCPTR(TIFFReadDirectory);
|
||||
MAKE_FUNCPTR(TIFFReadEncodedStrip);
|
||||
MAKE_FUNCPTR(TIFFReadEncodedTile);
|
||||
MAKE_FUNCPTR(TIFFSetDirectory);
|
||||
MAKE_FUNCPTR(TIFFSetField);
|
||||
MAKE_FUNCPTR(TIFFWriteDirectory);
|
||||
MAKE_FUNCPTR(TIFFWriteScanline);
|
||||
#undef MAKE_FUNCPTR
|
||||
|
||||
static void *load_libtiff(void)
|
||||
{
|
||||
void *result;
|
||||
|
||||
RtlEnterCriticalSection(&init_tiff_cs);
|
||||
|
||||
if (!libtiff_handle &&
|
||||
(libtiff_handle = dlopen(SONAME_LIBTIFF, RTLD_NOW)) != NULL)
|
||||
{
|
||||
void * (*pTIFFSetWarningHandler)(void *);
|
||||
void * (*pTIFFSetWarningHandlerExt)(void *);
|
||||
|
||||
#define LOAD_FUNCPTR(f) \
|
||||
if((p##f = dlsym(libtiff_handle, #f)) == NULL) { \
|
||||
ERR("failed to load symbol %s\n", #f); \
|
||||
libtiff_handle = NULL; \
|
||||
RtlLeaveCriticalSection(&init_tiff_cs); \
|
||||
return NULL; \
|
||||
}
|
||||
LOAD_FUNCPTR(TIFFClientOpen);
|
||||
LOAD_FUNCPTR(TIFFClose);
|
||||
LOAD_FUNCPTR(TIFFCurrentDirOffset);
|
||||
LOAD_FUNCPTR(TIFFGetField);
|
||||
LOAD_FUNCPTR(TIFFIsByteSwapped);
|
||||
LOAD_FUNCPTR(TIFFNumberOfDirectories);
|
||||
LOAD_FUNCPTR(TIFFReadDirectory);
|
||||
LOAD_FUNCPTR(TIFFReadEncodedStrip);
|
||||
LOAD_FUNCPTR(TIFFReadEncodedTile);
|
||||
LOAD_FUNCPTR(TIFFSetDirectory);
|
||||
LOAD_FUNCPTR(TIFFSetField);
|
||||
LOAD_FUNCPTR(TIFFWriteDirectory);
|
||||
LOAD_FUNCPTR(TIFFWriteScanline);
|
||||
#undef LOAD_FUNCPTR
|
||||
|
||||
if ((pTIFFSetWarningHandler = dlsym(libtiff_handle, "TIFFSetWarningHandler")))
|
||||
pTIFFSetWarningHandler(NULL);
|
||||
if ((pTIFFSetWarningHandlerExt = dlsym(libtiff_handle, "TIFFSetWarningHandlerExt")))
|
||||
pTIFFSetWarningHandlerExt(NULL);
|
||||
}
|
||||
|
||||
result = libtiff_handle;
|
||||
|
||||
RtlLeaveCriticalSection(&init_tiff_cs);
|
||||
return result;
|
||||
}
|
||||
|
||||
static tsize_t tiff_stream_read(thandle_t client_data, tdata_t data, tsize_t size)
|
||||
{
|
||||
IStream *stream = (IStream*)client_data;
|
||||
|
@ -215,7 +118,7 @@ static TIFF* tiff_open_stream(IStream *stream, const char *mode)
|
|||
{
|
||||
stream_seek(stream, 0, STREAM_SEEK_SET, NULL);
|
||||
|
||||
return pTIFFClientOpen("<IStream object>", mode, stream, tiff_stream_read,
|
||||
return TIFFClientOpen("<IStream object>", mode, stream, tiff_stream_read,
|
||||
tiff_stream_write, (void *)tiff_stream_seek, tiff_stream_close,
|
||||
(void *)tiff_stream_size, (void *)tiff_stream_map, (void *)tiff_stream_unmap);
|
||||
}
|
||||
|
@ -270,18 +173,18 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info)
|
|||
decode_info->tiled = 0;
|
||||
decode_info->source_bpp = 0;
|
||||
|
||||
ret = pTIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &photometric);
|
||||
ret = TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &photometric);
|
||||
if (!ret)
|
||||
{
|
||||
WARN("missing PhotometricInterpretation tag\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
ret = pTIFFGetField(tiff, TIFFTAG_BITSPERSAMPLE, &bps);
|
||||
ret = TIFFGetField(tiff, TIFFTAG_BITSPERSAMPLE, &bps);
|
||||
if (!ret) bps = 1;
|
||||
decode_info->bps = bps;
|
||||
|
||||
ret = pTIFFGetField(tiff, TIFFTAG_SAMPLESPERPIXEL, &samples);
|
||||
ret = TIFFGetField(tiff, TIFFTAG_SAMPLESPERPIXEL, &samples);
|
||||
if (!ret) samples = 1;
|
||||
decode_info->samples = samples;
|
||||
|
||||
|
@ -289,7 +192,7 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info)
|
|||
planar = 1;
|
||||
else
|
||||
{
|
||||
ret = pTIFFGetField(tiff, TIFFTAG_PLANARCONFIG, &planar);
|
||||
ret = TIFFGetField(tiff, TIFFTAG_PLANARCONFIG, &planar);
|
||||
if (!ret) planar = 1;
|
||||
if (planar != 1)
|
||||
{
|
||||
|
@ -309,7 +212,7 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info)
|
|||
case 1: /* BlackIsZero */
|
||||
if (samples == 2)
|
||||
{
|
||||
ret = pTIFFGetField(tiff, TIFFTAG_EXTRASAMPLES, &extra_sample_count, &extra_samples);
|
||||
ret = TIFFGetField(tiff, TIFFTAG_EXTRASAMPLES, &extra_sample_count, &extra_samples);
|
||||
if (!ret)
|
||||
{
|
||||
extra_sample_count = 1;
|
||||
|
@ -389,7 +292,7 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info)
|
|||
case 2: /* RGB */
|
||||
if (samples == 4)
|
||||
{
|
||||
ret = pTIFFGetField(tiff, TIFFTAG_EXTRASAMPLES, &extra_sample_count, &extra_samples);
|
||||
ret = TIFFGetField(tiff, TIFFTAG_EXTRASAMPLES, &extra_sample_count, &extra_samples);
|
||||
if (!ret)
|
||||
{
|
||||
extra_sample_count = 1;
|
||||
|
@ -529,25 +432,25 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info)
|
|||
return E_FAIL;
|
||||
}
|
||||
|
||||
ret = pTIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &decode_info->frame.width);
|
||||
ret = TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &decode_info->frame.width);
|
||||
if (!ret)
|
||||
{
|
||||
WARN("missing image width\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
ret = pTIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &decode_info->frame.height);
|
||||
ret = TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &decode_info->frame.height);
|
||||
if (!ret)
|
||||
{
|
||||
WARN("missing image length\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if ((ret = pTIFFGetField(tiff, TIFFTAG_TILEWIDTH, &decode_info->tile_width)))
|
||||
if ((ret = TIFFGetField(tiff, TIFFTAG_TILEWIDTH, &decode_info->tile_width)))
|
||||
{
|
||||
decode_info->tiled = 1;
|
||||
|
||||
ret = pTIFFGetField(tiff, TIFFTAG_TILELENGTH, &decode_info->tile_height);
|
||||
ret = TIFFGetField(tiff, TIFFTAG_TILELENGTH, &decode_info->tile_height);
|
||||
if (!ret)
|
||||
{
|
||||
WARN("missing tile height\n");
|
||||
|
@ -558,7 +461,7 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info)
|
|||
decode_info->tile_size = decode_info->tile_height * decode_info->tile_stride;
|
||||
decode_info->tiles_across = (decode_info->frame.width + decode_info->tile_width - 1) / decode_info->tile_width;
|
||||
}
|
||||
else if ((ret = pTIFFGetField(tiff, TIFFTAG_ROWSPERSTRIP, &decode_info->tile_height)))
|
||||
else if ((ret = TIFFGetField(tiff, TIFFTAG_ROWSPERSTRIP, &decode_info->tile_height)))
|
||||
{
|
||||
if (decode_info->tile_height > decode_info->frame.height)
|
||||
decode_info->tile_height = decode_info->frame.height;
|
||||
|
@ -576,9 +479,9 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info)
|
|||
}
|
||||
|
||||
resolution_unit = 0;
|
||||
pTIFFGetField(tiff, TIFFTAG_RESOLUTIONUNIT, &resolution_unit);
|
||||
TIFFGetField(tiff, TIFFTAG_RESOLUTIONUNIT, &resolution_unit);
|
||||
|
||||
ret = pTIFFGetField(tiff, TIFFTAG_XRESOLUTION, &xres);
|
||||
ret = TIFFGetField(tiff, TIFFTAG_XRESOLUTION, &xres);
|
||||
if (!ret)
|
||||
{
|
||||
WARN("missing X resolution\n");
|
||||
|
@ -590,7 +493,7 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info)
|
|||
xres = 0.0;
|
||||
}
|
||||
|
||||
ret = pTIFFGetField(tiff, TIFFTAG_YRESOLUTION, &yres);
|
||||
ret = TIFFGetField(tiff, TIFFTAG_YRESOLUTION, &yres);
|
||||
if (!ret)
|
||||
{
|
||||
WARN("missing Y resolution\n");
|
||||
|
@ -625,7 +528,7 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info)
|
|||
}
|
||||
|
||||
if (decode_info->indexed &&
|
||||
pTIFFGetField(tiff, TIFFTAG_COLORMAP, &red, &green, &blue))
|
||||
TIFFGetField(tiff, TIFFTAG_COLORMAP, &red, &green, &blue))
|
||||
{
|
||||
decode_info->frame.num_colors = 1 << decode_info->bps;
|
||||
for (i=0; i<decode_info->frame.num_colors; i++)
|
||||
|
@ -641,7 +544,7 @@ static HRESULT tiff_get_decode_info(TIFF *tiff, tiff_decode_info *decode_info)
|
|||
decode_info->frame.num_colors = 0;
|
||||
}
|
||||
|
||||
if (pTIFFGetField(tiff, TIFFTAG_ICCPROFILE, &len, &profile))
|
||||
if (TIFFGetField(tiff, TIFFTAG_ICCPROFILE, &len, &profile))
|
||||
decode_info->frame.num_color_contexts = 1;
|
||||
else
|
||||
decode_info->frame.num_color_contexts = 0;
|
||||
|
@ -658,7 +561,7 @@ static HRESULT CDECL tiff_decoder_initialize(struct decoder* iface, IStream *str
|
|||
if (!This->tiff)
|
||||
return E_FAIL;
|
||||
|
||||
This->frame_count = pTIFFNumberOfDirectories(This->tiff);
|
||||
This->frame_count = TIFFNumberOfDirectories(This->tiff);
|
||||
This->cached_frame = 0;
|
||||
hr = tiff_get_decode_info(This->tiff, &This->cached_decode_info);
|
||||
if (FAILED(hr))
|
||||
|
@ -671,7 +574,7 @@ static HRESULT CDECL tiff_decoder_initialize(struct decoder* iface, IStream *str
|
|||
return S_OK;
|
||||
|
||||
fail:
|
||||
pTIFFClose(This->tiff);
|
||||
TIFFClose(This->tiff);
|
||||
This->tiff = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
@ -690,7 +593,7 @@ static HRESULT tiff_decoder_select_frame(struct tiff_decoder* This, DWORD frame)
|
|||
|
||||
prev_tile_size = This->cached_tile ? This->cached_decode_info.tile_size : 0;
|
||||
|
||||
res = pTIFFSetDirectory(This->tiff, frame);
|
||||
res = TIFFSetDirectory(This->tiff, frame);
|
||||
if (!res)
|
||||
return E_INVALIDARG;
|
||||
|
||||
|
@ -738,12 +641,12 @@ static HRESULT tiff_decoder_read_tile(struct tiff_decoder *This, UINT tile_x, UI
|
|||
int swap_bytes;
|
||||
tiff_decode_info *info = &This->cached_decode_info;
|
||||
|
||||
swap_bytes = pTIFFIsByteSwapped(This->tiff);
|
||||
swap_bytes = TIFFIsByteSwapped(This->tiff);
|
||||
|
||||
if (info->tiled)
|
||||
ret = pTIFFReadEncodedTile(This->tiff, tile_x + tile_y * info->tiles_across, This->cached_tile, info->tile_size);
|
||||
ret = TIFFReadEncodedTile(This->tiff, tile_x + tile_y * info->tiles_across, This->cached_tile, info->tile_size);
|
||||
else
|
||||
ret = pTIFFReadEncodedStrip(This->tiff, tile_y, This->cached_tile, info->tile_size);
|
||||
ret = TIFFReadEncodedStrip(This->tiff, tile_y, This->cached_tile, info->tile_size);
|
||||
|
||||
if (ret == -1)
|
||||
return E_FAIL;
|
||||
|
@ -1093,7 +996,7 @@ static HRESULT CDECL tiff_decoder_get_color_context(struct decoder *iface,
|
|||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
if (!pTIFFGetField(This->tiff, TIFFTAG_ICCPROFILE, &len, &profile))
|
||||
if (!TIFFGetField(This->tiff, TIFFTAG_ICCPROFILE, &len, &profile))
|
||||
{
|
||||
return E_UNEXPECTED;
|
||||
}
|
||||
|
@ -1122,10 +1025,10 @@ static HRESULT CDECL tiff_decoder_get_metadata_blocks(struct decoder *iface,
|
|||
|
||||
*count = 1;
|
||||
|
||||
result.offset = pTIFFCurrentDirOffset(This->tiff);
|
||||
result.offset = TIFFCurrentDirOffset(This->tiff);
|
||||
result.length = 0;
|
||||
|
||||
byte_swapped = pTIFFIsByteSwapped(This->tiff);
|
||||
byte_swapped = TIFFIsByteSwapped(This->tiff);
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
result.options = byte_swapped ? WICPersistOptionLittleEndian : WICPersistOptionBigEndian;
|
||||
#else
|
||||
|
@ -1143,7 +1046,7 @@ static HRESULT CDECL tiff_decoder_get_metadata_blocks(struct decoder *iface,
|
|||
static void CDECL tiff_decoder_destroy(struct decoder* iface)
|
||||
{
|
||||
struct tiff_decoder *This = impl_from_decoder(iface);
|
||||
if (This->tiff) pTIFFClose(This->tiff);
|
||||
if (This->tiff) TIFFClose(This->tiff);
|
||||
free(This->cached_tile);
|
||||
RtlFreeHeap(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
@ -1161,12 +1064,6 @@ HRESULT CDECL tiff_decoder_create(struct decoder_info *info, struct decoder **re
|
|||
{
|
||||
struct tiff_decoder *This;
|
||||
|
||||
if (!load_libtiff())
|
||||
{
|
||||
ERR("Failed reading TIFF because unable to load %s\n",SONAME_LIBTIFF);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
This = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(*This));
|
||||
if (!This) return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -1270,7 +1167,7 @@ static HRESULT CDECL tiff_encoder_create_frame(struct encoder* iface, const stru
|
|||
int i;
|
||||
|
||||
if (This->num_frames != 0)
|
||||
pTIFFWriteDirectory(This->tiff);
|
||||
TIFFWriteDirectory(This->tiff);
|
||||
|
||||
This->num_frames++;
|
||||
This->lines_written = 0;
|
||||
|
@ -1284,27 +1181,27 @@ static HRESULT CDECL tiff_encoder_create_frame(struct encoder* iface, const stru
|
|||
|
||||
This->format = &formats[i];
|
||||
|
||||
pTIFFSetField(This->tiff, TIFFTAG_PHOTOMETRIC, (uint16_t)This->format->photometric);
|
||||
pTIFFSetField(This->tiff, TIFFTAG_PLANARCONFIG, (uint16_t)1);
|
||||
pTIFFSetField(This->tiff, TIFFTAG_BITSPERSAMPLE, (uint16_t)This->format->bps);
|
||||
pTIFFSetField(This->tiff, TIFFTAG_SAMPLESPERPIXEL, (uint16_t)This->format->samples);
|
||||
TIFFSetField(This->tiff, TIFFTAG_PHOTOMETRIC, (uint16_t)This->format->photometric);
|
||||
TIFFSetField(This->tiff, TIFFTAG_PLANARCONFIG, (uint16_t)1);
|
||||
TIFFSetField(This->tiff, TIFFTAG_BITSPERSAMPLE, (uint16_t)This->format->bps);
|
||||
TIFFSetField(This->tiff, TIFFTAG_SAMPLESPERPIXEL, (uint16_t)This->format->samples);
|
||||
|
||||
if (This->format->extra_sample)
|
||||
{
|
||||
uint16_t extra_samples;
|
||||
extra_samples = This->format->extra_sample_type;
|
||||
|
||||
pTIFFSetField(This->tiff, TIFFTAG_EXTRASAMPLES, (uint16_t)1, &extra_samples);
|
||||
TIFFSetField(This->tiff, TIFFTAG_EXTRASAMPLES, (uint16_t)1, &extra_samples);
|
||||
}
|
||||
|
||||
pTIFFSetField(This->tiff, TIFFTAG_IMAGEWIDTH, (uint32_t)frame->width);
|
||||
pTIFFSetField(This->tiff, TIFFTAG_IMAGELENGTH, (uint32_t)frame->height);
|
||||
TIFFSetField(This->tiff, TIFFTAG_IMAGEWIDTH, (uint32_t)frame->width);
|
||||
TIFFSetField(This->tiff, TIFFTAG_IMAGELENGTH, (uint32_t)frame->height);
|
||||
|
||||
if (frame->dpix != 0.0 && frame->dpiy != 0.0)
|
||||
{
|
||||
pTIFFSetField(This->tiff, TIFFTAG_RESOLUTIONUNIT, (uint16_t)2); /* Inch */
|
||||
pTIFFSetField(This->tiff, TIFFTAG_XRESOLUTION, (float)frame->dpix);
|
||||
pTIFFSetField(This->tiff, TIFFTAG_YRESOLUTION, (float)frame->dpiy);
|
||||
TIFFSetField(This->tiff, TIFFTAG_RESOLUTIONUNIT, (uint16_t)2); /* Inch */
|
||||
TIFFSetField(This->tiff, TIFFTAG_XRESOLUTION, (float)frame->dpix);
|
||||
TIFFSetField(This->tiff, TIFFTAG_YRESOLUTION, (float)frame->dpiy);
|
||||
}
|
||||
|
||||
if (This->format->bpp <= 8 && frame->num_colors && This->format->indexed)
|
||||
|
@ -1319,7 +1216,7 @@ static HRESULT CDECL tiff_encoder_create_frame(struct encoder* iface, const stru
|
|||
blue[i] = (frame->palette[i] << 8) & 0xff00;
|
||||
}
|
||||
|
||||
pTIFFSetField(This->tiff, TIFFTAG_COLORMAP, red, green, blue);
|
||||
TIFFSetField(This->tiff, TIFFTAG_COLORMAP, red, green, blue);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
@ -1358,7 +1255,7 @@ static HRESULT CDECL tiff_encoder_write_lines(struct encoder* iface,
|
|||
row_data = swapped_data;
|
||||
}
|
||||
|
||||
pTIFFWriteScanline(This->tiff, (tdata_t)row_data, i+This->lines_written, 0);
|
||||
TIFFWriteScanline(This->tiff, (tdata_t)row_data, i+This->lines_written, 0);
|
||||
}
|
||||
|
||||
This->lines_written += line_count;
|
||||
|
@ -1375,7 +1272,7 @@ static HRESULT CDECL tiff_encoder_commit_file(struct encoder* iface)
|
|||
{
|
||||
struct tiff_encoder* This = impl_from_encoder(iface);
|
||||
|
||||
pTIFFClose(This->tiff);
|
||||
TIFFClose(This->tiff);
|
||||
This->tiff = NULL;
|
||||
|
||||
return S_OK;
|
||||
|
@ -1385,7 +1282,7 @@ static void CDECL tiff_encoder_destroy(struct encoder* iface)
|
|||
{
|
||||
struct tiff_encoder *This = impl_from_encoder(iface);
|
||||
|
||||
if (This->tiff) pTIFFClose(This->tiff);
|
||||
if (This->tiff) TIFFClose(This->tiff);
|
||||
RtlFreeHeap(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
|
@ -1403,12 +1300,6 @@ HRESULT CDECL tiff_encoder_create(struct encoder_info *info, struct encoder **re
|
|||
{
|
||||
struct tiff_encoder *This;
|
||||
|
||||
if (!load_libtiff())
|
||||
{
|
||||
ERR("Failed writing TIFF because unable to load %s\n",SONAME_LIBTIFF);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
This = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(*This));
|
||||
if (!This) return E_OUTOFMEMORY;
|
||||
|
||||
|
@ -1427,19 +1318,3 @@ HRESULT CDECL tiff_encoder_create(struct encoder_info *info, struct encoder **re
|
|||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#else /* !SONAME_LIBTIFF */
|
||||
|
||||
HRESULT CDECL tiff_decoder_create(struct decoder_info *info, struct decoder **result)
|
||||
{
|
||||
ERR("Trying to load TIFF picture, but Wine was compiled without TIFF support.\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
HRESULT CDECL tiff_encoder_create(struct encoder_info *info, struct encoder **result)
|
||||
{
|
||||
ERR("Trying to save TIFF picture, but Wine was compiled without TIFF support.\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -81,7 +81,7 @@ HRESULT TiffDecoder_CreateInstance(REFIID iid, void** ppv)
|
|||
struct decoder *decoder;
|
||||
struct decoder_info decoder_info;
|
||||
|
||||
hr = get_unix_decoder(&CLSID_WICTiffDecoder, &decoder_info, &decoder);
|
||||
hr = tiff_decoder_create(&decoder_info, &decoder);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
hr = CommonDecoder_CreateInstance(decoder, &decoder_info, iid, ppv);
|
||||
|
@ -95,7 +95,7 @@ HRESULT TiffEncoder_CreateInstance(REFIID iid, void** ppv)
|
|||
struct encoder *encoder;
|
||||
struct encoder_info encoder_info;
|
||||
|
||||
hr = get_unix_encoder(&CLSID_WICTiffEncoder, &encoder_info, &encoder);
|
||||
hr = tiff_encoder_create(&encoder_info, &encoder);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
hr = CommonEncoder_CreateInstance(encoder, &encoder_info, iid, ppv);
|
||||
|
|
|
@ -69,17 +69,11 @@ HRESULT CDECL stream_write(IStream *stream, const void *buffer, ULONG write, ULO
|
|||
|
||||
HRESULT CDECL decoder_create(const CLSID *decoder_clsid, struct decoder_info *info, struct decoder **result)
|
||||
{
|
||||
if (IsEqualGUID(decoder_clsid, &CLSID_WICTiffDecoder))
|
||||
return tiff_decoder_create(info, result);
|
||||
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
HRESULT CDECL encoder_create(const CLSID *encoder_clsid, struct encoder_info *info, struct encoder **result)
|
||||
{
|
||||
if (IsEqualGUID(encoder_clsid, &CLSID_WICTiffEncoder))
|
||||
return tiff_encoder_create(info, result);
|
||||
|
||||
if (IsEqualGUID(encoder_clsid, &CLSID_WICIcnsEncoder))
|
||||
return icns_encoder_create(info, result);
|
||||
|
||||
|
|
|
@ -827,9 +827,6 @@
|
|||
/* Define to 1 if you have the `thr_kill2' function. */
|
||||
#undef HAVE_THR_KILL2
|
||||
|
||||
/* Define to 1 if you have the <tiffio.h> header file. */
|
||||
#undef HAVE_TIFFIO_H
|
||||
|
||||
/* Define to 1 if you have the `udev' library (-ludev). */
|
||||
#undef HAVE_UDEV
|
||||
|
||||
|
@ -1028,9 +1025,6 @@
|
|||
/* Define to the soname of the libSDL2 library. */
|
||||
#undef SONAME_LIBSDL2
|
||||
|
||||
/* Define to the soname of the libtiff library. */
|
||||
#undef SONAME_LIBTIFF
|
||||
|
||||
/* Define to the soname of the libv4l2 library. */
|
||||
#undef SONAME_LIBV4L2
|
||||
|
||||
|
|
Loading…
Reference in New Issue