Added GIF decompressor support to OLE Automation IPictures.
This commit is contained in:
parent
cf5c35bc81
commit
728bedcfc6
|
@ -308,7 +308,7 @@ ac_includes_default="\
|
|||
# include <unistd.h>
|
||||
#endif"
|
||||
|
||||
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS OPTIONS WIN16_FILES WIN16_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP TOOLSDIR X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS YACC LEX LEXLIB LEX_OUTPUT_ROOT XYACC XLEX AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES LN_S LN C2MAN LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS DB2HTML DB2PDF DB2PS JPEGLIB EGREP XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ft_devel ft_devel2 FREETYPEINCL ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS DLLEXT DLLFLAGS DLLIBS LDDLLFLAGS LDSHARED LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP CROSSTEST CROSSCC LDPATH CRTLIBS LDD ALLOCA LIBOBJS LTLIBOBJS'
|
||||
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS OPTIONS WIN16_FILES WIN16_INSTALL build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP TOOLSDIR X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS YACC LEX LEXLIB LEX_OUTPUT_ROOT XYACC XLEX AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES LN_S LN C2MAN LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS DB2HTML DB2PDF DB2PS JPEGLIB EGREP GIFLIB XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ft_devel ft_devel2 FREETYPEINCL ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS DLLEXT DLLFLAGS DLLIBS LDDLLFLAGS LDSHARED LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP CROSSTEST CROSSCC LDPATH CRTLIBS LDD ALLOCA LIBOBJS LTLIBOBJS'
|
||||
ac_subst_files='MAKE_RULES MAKE_DLL_RULES MAKE_TEST_RULES MAKE_PROG_RULES'
|
||||
|
||||
# Initialize some variables set by options.
|
||||
|
@ -6378,6 +6378,276 @@ fi
|
|||
done
|
||||
|
||||
|
||||
GIFLIB=""
|
||||
|
||||
|
||||
for ac_header in gif_lib.h
|
||||
do
|
||||
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
if eval "test \"\${$as_ac_Header+set}\" = set"; then
|
||||
echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
|
||||
if eval "test \"\${$as_ac_Header+set}\" = set"; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
|
||||
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
|
||||
else
|
||||
# Is the header compilable?
|
||||
echo "$as_me:$LINENO: checking $ac_header usability" >&5
|
||||
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest.$ac_objext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_header_compiler=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_compiler=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest.$ac_ext
|
||||
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
|
||||
echo "${ECHO_T}$ac_header_compiler" >&6
|
||||
|
||||
# Is the header present?
|
||||
echo "$as_me:$LINENO: checking $ac_header presence" >&5
|
||||
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
#include <$ac_header>
|
||||
_ACEOF
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
|
||||
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } >/dev/null; then
|
||||
if test -s conftest.err; then
|
||||
ac_cpp_err=$ac_c_preproc_warn_flag
|
||||
else
|
||||
ac_cpp_err=
|
||||
fi
|
||||
else
|
||||
ac_cpp_err=yes
|
||||
fi
|
||||
if test -z "$ac_cpp_err"; then
|
||||
ac_header_preproc=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_header_preproc=no
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_ext
|
||||
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
|
||||
echo "${ECHO_T}$ac_header_preproc" >&6
|
||||
|
||||
# So? What about this header?
|
||||
case $ac_header_compiler:$ac_header_preproc in
|
||||
yes:no )
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
|
||||
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
|
||||
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
|
||||
(
|
||||
cat <<\_ASBOX
|
||||
## ------------------------------------ ##
|
||||
## Report this to bug-autoconf@gnu.org. ##
|
||||
## ------------------------------------ ##
|
||||
_ASBOX
|
||||
) |
|
||||
sed "s/^/$as_me: WARNING: /" >&2
|
||||
;;
|
||||
no:yes )
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
|
||||
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
|
||||
echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
|
||||
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
|
||||
echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
|
||||
(
|
||||
cat <<\_ASBOX
|
||||
## ------------------------------------ ##
|
||||
## Report this to bug-autoconf@gnu.org. ##
|
||||
## ------------------------------------ ##
|
||||
_ASBOX
|
||||
) |
|
||||
sed "s/^/$as_me: WARNING: /" >&2
|
||||
;;
|
||||
esac
|
||||
echo "$as_me:$LINENO: checking for $ac_header" >&5
|
||||
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
|
||||
if eval "test \"\${$as_ac_Header+set}\" = set"; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
eval "$as_ac_Header=$ac_header_preproc"
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
|
||||
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
|
||||
|
||||
fi
|
||||
if test `eval echo '${'$as_ac_Header'}'` = yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
echo "$as_me:$LINENO: checking for DGifOpen in -lungif" >&5
|
||||
echo $ECHO_N "checking for DGifOpen in -lungif... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_ungif_DGifOpen+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lungif $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char DGifOpen ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
DGifOpen ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_lib_ungif_DGifOpen=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_ungif_DGifOpen=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_lib_ungif_DGifOpen" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_ungif_DGifOpen" >&6
|
||||
if test $ac_cv_lib_ungif_DGifOpen = yes; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_LIBGIF 1
|
||||
_ACEOF
|
||||
|
||||
GIFLIB="-lungif"
|
||||
else
|
||||
echo "$as_me:$LINENO: checking for DGifOpen in -lgif" >&5
|
||||
echo $ECHO_N "checking for DGifOpen in -lgif... $ECHO_C" >&6
|
||||
if test "${ac_cv_lib_gif_DGifOpen+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lgif $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
#line $LINENO "configure"
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char DGifOpen ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
DGifOpen ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
ac_cv_lib_gif_DGifOpen=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_gif_DGifOpen=no
|
||||
fi
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: $ac_cv_lib_gif_DGifOpen" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_gif_DGifOpen" >&6
|
||||
if test $ac_cv_lib_gif_DGifOpen = yes; then
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_LIBGIF 1
|
||||
_ACEOF
|
||||
|
||||
GIFLIB="-lgif"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -16234,6 +16504,7 @@ s,@DB2PDF@,$DB2PDF,;t t
|
|||
s,@DB2PS@,$DB2PS,;t t
|
||||
s,@JPEGLIB@,$JPEGLIB,;t t
|
||||
s,@EGREP@,$EGREP,;t t
|
||||
s,@GIFLIB@,$GIFLIB,;t t
|
||||
s,@XLIB@,$XLIB,;t t
|
||||
s,@XFILES@,$XFILES,;t t
|
||||
s,@OPENGLFILES@,$OPENGLFILES,;t t
|
||||
|
|
|
@ -147,6 +147,15 @@ AC_CHECK_HEADERS(jpeglib.h,
|
|||
)
|
||||
)
|
||||
|
||||
AC_SUBST(GIFLIB,"")
|
||||
AC_CHECK_HEADERS(gif_lib.h,
|
||||
AC_CHECK_LIB(ungif,DGifOpen,
|
||||
[AC_DEFINE(HAVE_LIBGIF,1,[Define if you have libgif/libungif including devel headers])
|
||||
GIFLIB="-lungif"],
|
||||
[AC_CHECK_LIB(gif,DGifOpen,
|
||||
[AC_DEFINE(HAVE_LIBGIF,1)
|
||||
GIFLIB="-lgif"])]))
|
||||
|
||||
|
||||
AC_SUBST(XLIB)
|
||||
AC_SUBST(XFILES)
|
||||
|
|
|
@ -7,7 +7,7 @@ MODULE = oleaut32.dll
|
|||
IMPORTS = ole32 user32 gdi32 advapi32 kernel32
|
||||
DELAYIMPORTS = comctl32
|
||||
ALTNAMES = ole2disp.dll typelib.dll
|
||||
EXTRALIBS = $(LIBUNICODE) $(LIBUUID) @JPEGLIB@
|
||||
EXTRALIBS = $(LIBUNICODE) $(LIBUUID) @GIFLIB@ @JPEGLIB@
|
||||
|
||||
LDDLLFLAGS = @LDDLLFLAGS@
|
||||
SYMBOLFILE = $(MODULE).tmp.o
|
||||
|
|
|
@ -43,6 +43,13 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Must be before wine includes, the header has things conflicting with
|
||||
* WINE headers.
|
||||
*/
|
||||
#ifdef HAVE_LIBGIF
|
||||
# include <gif_lib.h>
|
||||
#endif
|
||||
|
||||
#define NONAMELESSUNION
|
||||
#define NONAMELESSSTRUCT
|
||||
#include "winerror.h"
|
||||
|
@ -813,6 +820,26 @@ static boolean _jpeg_resync_to_restart(j_decompress_ptr cinfo, int desired) {
|
|||
static void _jpeg_term_source(j_decompress_ptr cinfo) { }
|
||||
#endif /* HAVE_LIBJPEG */
|
||||
|
||||
#ifdef HAVE_LIBGIF
|
||||
struct gifdata {
|
||||
unsigned char *data;
|
||||
unsigned int curoff;
|
||||
unsigned int len;
|
||||
};
|
||||
|
||||
static int _gif_inputfunc(GifFileType *gif, GifByteType *data, int len) {
|
||||
struct gifdata *gd = (struct gifdata*)gif->UserData;
|
||||
|
||||
if (len+gd->curoff > gd->len) {
|
||||
FIXME("Trying to read %d bytes, but only %d available.\n",len, gd->len-gd->curoff);
|
||||
len = gd->len - gd->curoff;
|
||||
}
|
||||
memcpy(data, gd->data+gd->curoff, len);
|
||||
gd->curoff += len;
|
||||
return len;
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************************************************************
|
||||
* OLEPictureImpl_IPersistStream_Load (IUnknown)
|
||||
*
|
||||
|
@ -829,30 +856,134 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
|
|||
BYTE *xbuf;
|
||||
DWORD header[2];
|
||||
WORD magic;
|
||||
STATSTG statstg;
|
||||
ICOM_THIS_From_IPersistStream(OLEPictureImpl, iface);
|
||||
|
||||
TRACE("(%p,%p)\n",This,pStm);
|
||||
|
||||
/* Sometimes we have a header, sometimes we don't. Apply some guesses to find
|
||||
* out whether we do.
|
||||
*/
|
||||
hr=IStream_Stat(pStm,&statstg,STATFLAG_NONAME);
|
||||
if (hr)
|
||||
FIXME("Stat failed with hres %lx\n",hr);
|
||||
hr=IStream_Read(pStm,header,8,&xread);
|
||||
if (hr || xread!=8) {
|
||||
FIXME("Failure while reading picture header (hr is %lx, nread is %ld).\n",hr,xread);
|
||||
return hr;
|
||||
}
|
||||
xread = 0;
|
||||
xbuf = This->data = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,header[1]);
|
||||
This->datalen = header[1];
|
||||
while (xread < header[1]) {
|
||||
ULONG nread;
|
||||
hr = IStream_Read(pStm,xbuf+xread,header[1]-xread,&nread);
|
||||
xread+=nread;
|
||||
if (hr || !nread)
|
||||
break;
|
||||
if (header[1] > statstg.cbSize.QuadPart) {/* Incorrect header, assume none. */
|
||||
xread = 8;
|
||||
xbuf = This->data = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,statstg.cbSize.QuadPart);
|
||||
memcpy(xbuf,&header,8);
|
||||
This->datalen = statstg.cbSize.QuadPart;
|
||||
while (xread < This->datalen) {
|
||||
ULONG nread;
|
||||
hr = IStream_Read(pStm,xbuf+xread,This->datalen-xread,&nread);
|
||||
xread+=nread;
|
||||
if (hr || !nread)
|
||||
break;
|
||||
}
|
||||
if (xread != This->datalen)
|
||||
FIXME("Could only read %ld of %d bytes in no-header case?\n",xread,This->datalen);
|
||||
} else {
|
||||
xread = 0;
|
||||
xbuf = This->data = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,header[1]);
|
||||
This->datalen = header[1];
|
||||
while (xread < header[1]) {
|
||||
ULONG nread;
|
||||
hr = IStream_Read(pStm,xbuf+xread,header[1]-xread,&nread);
|
||||
xread+=nread;
|
||||
if (hr || !nread)
|
||||
break;
|
||||
}
|
||||
if (xread != header[1])
|
||||
FIXME("Could only read %ld of %ld bytes?\n",xread,header[1]);
|
||||
}
|
||||
if (xread != header[1])
|
||||
FIXME("Could only read %ld of %ld bytes?\n",xread,header[1]);
|
||||
|
||||
magic = xbuf[0] + (xbuf[1]<<8);
|
||||
switch (magic) {
|
||||
case 0x4947: { /* GIF */
|
||||
#ifdef HAVE_LIBGIF
|
||||
struct gifdata gd;
|
||||
GifFileType *gif;
|
||||
BITMAPINFO *bmi;
|
||||
HDC hdcref;
|
||||
LPBYTE bytes;
|
||||
int i,j,ret;
|
||||
GifImageDesc *gid;
|
||||
SavedImage *si;
|
||||
ColorMapObject *cm;
|
||||
|
||||
gd.data = xbuf;
|
||||
gd.curoff = 0;
|
||||
gd.len = xread;
|
||||
gif = DGifOpen((void*)&gd, _gif_inputfunc);
|
||||
ret = DGifSlurp(gif);
|
||||
if (ret == GIF_ERROR) {
|
||||
FIXME("Failed reading GIF using libgif.\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
TRACE("screen height %d, width %d\n", gif->SWidth, gif->SHeight);
|
||||
TRACE("color res %d, backgcolor %d\n", gif->SColorResolution, gif->SBackGroundColor);
|
||||
TRACE("imgcnt %d\n", gif->ImageCount);
|
||||
if (gif->ImageCount<1) {
|
||||
FIXME("GIF stream does not have images inside?\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
TRACE("curimage: %d x %d, on %dx%d, interlace %d\n",
|
||||
gif->Image.Width, gif->Image.Height,
|
||||
gif->Image.Left, gif->Image.Top,
|
||||
gif->Image.Interlace
|
||||
);
|
||||
/* */
|
||||
bmi = HeapAlloc(GetProcessHeap(),0,sizeof(BITMAPINFOHEADER)+(1<<gif->SColorResolution)*sizeof(RGBQUAD));
|
||||
bytes= HeapAlloc(GetProcessHeap(),0,gif->SWidth*gif->SHeight);
|
||||
si = gif->SavedImages+0;
|
||||
gid = &(si->ImageDesc);
|
||||
cm = gid->ColorMap;
|
||||
if (!cm) cm = gif->SColorMap;
|
||||
for (i=0;i<(1<<gif->SColorResolution);i++) {
|
||||
bmi->bmiColors[i].rgbRed = cm->Colors[i].Red;
|
||||
bmi->bmiColors[i].rgbGreen = cm->Colors[i].Green;
|
||||
bmi->bmiColors[i].rgbBlue = cm->Colors[i].Blue;
|
||||
}
|
||||
/* Map to in picture coordinates */
|
||||
for (i=0;i<gid->Height;i++)
|
||||
for (j=0;j<gid->Width;j++)
|
||||
bytes[(gid->Top+i)*gif->SWidth+gid->Left+j]=si->RasterBits[i*gid->Width+j];
|
||||
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bmi->bmiHeader.biWidth = gif->SWidth;
|
||||
bmi->bmiHeader.biHeight = gif->SHeight;
|
||||
bmi->bmiHeader.biPlanes = 1;
|
||||
bmi->bmiHeader.biBitCount = 8;
|
||||
bmi->bmiHeader.biCompression = BI_RGB;
|
||||
bmi->bmiHeader.biSizeImage = gif->SWidth*gif->SHeight;
|
||||
bmi->bmiHeader.biXPelsPerMeter = 0;
|
||||
bmi->bmiHeader.biYPelsPerMeter = 0;
|
||||
bmi->bmiHeader.biClrUsed = 1 << gif->SColorResolution;
|
||||
bmi->bmiHeader.biClrImportant = 0;
|
||||
|
||||
hdcref = GetDC(0);
|
||||
This->desc.u.bmp.hbitmap=CreateDIBitmap(
|
||||
hdcref,
|
||||
&bmi->bmiHeader,
|
||||
CBM_INIT,
|
||||
bytes,
|
||||
bmi,
|
||||
DIB_PAL_COLORS
|
||||
);
|
||||
DeleteDC(hdcref);
|
||||
This->desc.picType = PICTYPE_BITMAP;
|
||||
OLEPictureImpl_SetBitmap(This);
|
||||
DGifCloseFile(gif);
|
||||
HeapFree(GetProcessHeap(),0,bytes);
|
||||
return S_OK;
|
||||
#else
|
||||
FIXME("Trying to load GIF, but no support for libgif/libungif compiled in.\n");
|
||||
return E_FAIL;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 0xd8ff: { /* JPEG */
|
||||
#ifdef HAVE_LIBJPEG
|
||||
struct jpeg_decompress_struct jd;
|
||||
|
@ -1012,10 +1143,19 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface,IStream*pStm) {
|
|||
break;
|
||||
}
|
||||
default:
|
||||
FIXME("Unknown magic %04x\n",magic);
|
||||
{
|
||||
int i;
|
||||
FIXME("Unknown magic %04x, %ld read bytes:\n",magic,xread);
|
||||
hr=E_FAIL;
|
||||
for (i=0;i<xread+8;i++) {
|
||||
if (i<8) MESSAGE("%02x ",((unsigned char*)&header)[i]);
|
||||
else MESSAGE("%02x ",xbuf[i-8]);
|
||||
if (i % 10 == 9) MESSAGE("\n");
|
||||
}
|
||||
MESSAGE("\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: this notify is not really documented */
|
||||
if (hr==S_OK)
|
||||
|
|
|
@ -164,6 +164,9 @@
|
|||
/* Define to 1 if you have the `getsockopt' function. */
|
||||
#undef HAVE_GETSOCKOPT
|
||||
|
||||
/* Define to 1 if you have the <gif_lib.h> header file. */
|
||||
#undef HAVE_GIF_LIB_H
|
||||
|
||||
/* Define if the OpenGL headers define extension typedefs */
|
||||
#undef HAVE_GLEXT_PROTOTYPES
|
||||
|
||||
|
@ -218,6 +221,9 @@
|
|||
/* Define if you have the curses library (-lcurses) */
|
||||
#undef HAVE_LIBCURSES
|
||||
|
||||
/* Define if you have libgif/libungif including devel headers */
|
||||
#undef HAVE_LIBGIF
|
||||
|
||||
/* Define to 1 if you have the `i386' library (-li386). */
|
||||
#undef HAVE_LIBI386
|
||||
|
||||
|
|
Loading…
Reference in New Issue