mscms: Port to liblcms2.
This commit is contained in:
parent
f5f04e8a2f
commit
d40c91262b
|
@ -653,8 +653,8 @@ LIBGETTEXTPO
|
||||||
ZLIB
|
ZLIB
|
||||||
FREETYPE_LIBS
|
FREETYPE_LIBS
|
||||||
FREETYPE_CFLAGS
|
FREETYPE_CFLAGS
|
||||||
LCMS_LIBS
|
LCMS2_LIBS
|
||||||
LCMS_CFLAGS
|
LCMS2_CFLAGS
|
||||||
RESOLVLIBS
|
RESOLVLIBS
|
||||||
GPHOTO2_PORT_LIBS
|
GPHOTO2_PORT_LIBS
|
||||||
GPHOTO2_PORT_CFLAGS
|
GPHOTO2_PORT_CFLAGS
|
||||||
|
@ -880,8 +880,8 @@ GPHOTO2_CFLAGS
|
||||||
GPHOTO2_LIBS
|
GPHOTO2_LIBS
|
||||||
GPHOTO2_PORT_CFLAGS
|
GPHOTO2_PORT_CFLAGS
|
||||||
GPHOTO2_PORT_LIBS
|
GPHOTO2_PORT_LIBS
|
||||||
LCMS_CFLAGS
|
LCMS2_CFLAGS
|
||||||
LCMS_LIBS
|
LCMS2_LIBS
|
||||||
FREETYPE_CFLAGS
|
FREETYPE_CFLAGS
|
||||||
FREETYPE_LIBS
|
FREETYPE_LIBS
|
||||||
GSTREAMER_CFLAGS
|
GSTREAMER_CFLAGS
|
||||||
|
@ -1596,8 +1596,9 @@ Some influential environment variables:
|
||||||
C compiler flags for libgphoto2_port, overriding pkg-config
|
C compiler flags for libgphoto2_port, overriding pkg-config
|
||||||
GPHOTO2_PORT_LIBS
|
GPHOTO2_PORT_LIBS
|
||||||
Linker flags for libgphoto2_port, overriding pkg-config
|
Linker flags for libgphoto2_port, overriding pkg-config
|
||||||
LCMS_CFLAGS C compiler flags for lcms, overriding pkg-config
|
LCMS2_CFLAGS
|
||||||
LCMS_LIBS Linker flags for lcms, overriding pkg-config
|
C compiler flags for lcms2, overriding pkg-config
|
||||||
|
LCMS2_LIBS Linker flags for lcms2, overriding pkg-config
|
||||||
FREETYPE_CFLAGS
|
FREETYPE_CFLAGS
|
||||||
C compiler flags for freetype2, overriding pkg-config
|
C compiler flags for freetype2, overriding pkg-config
|
||||||
FREETYPE_LIBS
|
FREETYPE_LIBS
|
||||||
|
@ -10758,45 +10759,44 @@ rm -f core conftest.err conftest.$ac_objext \
|
||||||
LIBS="$ac_save_LIBS"
|
LIBS="$ac_save_LIBS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$with_lcms" != "xno"
|
if test "x$with_lcms2" != "xno"
|
||||||
then
|
then
|
||||||
ac_save_CPPFLAGS="$CPPFLAGS"
|
ac_save_CPPFLAGS="$CPPFLAGS"
|
||||||
if test -n "$LCMS_CFLAGS"; then :
|
if test -n "$LCMS2_CFLAGS"; then :
|
||||||
|
|
||||||
elif test -n "$PKG_CONFIG"; then :
|
elif test -n "$PKG_CONFIG"; then :
|
||||||
LCMS_CFLAGS=`$PKG_CONFIG --cflags lcms 2>/dev/null`
|
LCMS2_CFLAGS=`$PKG_CONFIG --cflags lcms2 2>/dev/null`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CPPFLAGS="$CPPFLAGS $LCMS_CFLAGS"
|
CPPFLAGS="$CPPFLAGS $LCMS2_CFLAGS"
|
||||||
if test -n "$LCMS_LIBS"; then :
|
if test -n "$LCMS2_LIBS"; then :
|
||||||
|
|
||||||
elif test -n "$PKG_CONFIG"; then :
|
elif test -n "$PKG_CONFIG"; then :
|
||||||
LCMS_LIBS=`$PKG_CONFIG --libs lcms 2>/dev/null`
|
LCMS2_LIBS=`$PKG_CONFIG --libs lcms2 2>/dev/null`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LCMS_LIBS=${LCMS_LIBS:-"-llcms"}
|
LCMS2_LIBS=${LCMS2_LIBS:-"-llcms2"}
|
||||||
for ac_header in lcms.h lcms/lcms.h
|
for ac_header in lcms2.h
|
||||||
do :
|
do :
|
||||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
ac_fn_c_check_header_mongrel "$LINENO" "lcms2.h" "ac_cv_header_lcms2_h" "$ac_includes_default"
|
||||||
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
if test "x$ac_cv_header_lcms2_h" = xyes; then :
|
||||||
if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
|
#define HAVE_LCMS2_H 1
|
||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if test "$ac_cv_header_lcms_h" = "yes" -o "$ac_cv_header_lcms_lcms_h" = "yes"
|
if test "$ac_cv_header_lcms2_h" = "yes"
|
||||||
then
|
then
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cmsOpenProfileFromFile in -llcms" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cmsOpenProfileFromFile in -llcms2" >&5
|
||||||
$as_echo_n "checking for cmsOpenProfileFromFile in -llcms... " >&6; }
|
$as_echo_n "checking for cmsOpenProfileFromFile in -llcms2... " >&6; }
|
||||||
if ${ac_cv_lib_lcms_cmsOpenProfileFromFile+:} false; then :
|
if ${ac_cv_lib_lcms2_cmsOpenProfileFromFile+:} false; then :
|
||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
else
|
else
|
||||||
ac_check_lib_save_LIBS=$LIBS
|
ac_check_lib_save_LIBS=$LIBS
|
||||||
LIBS="-llcms $LIBS"
|
LIBS="-llcms2 $LIBS"
|
||||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
@ -10816,35 +10816,35 @@ return cmsOpenProfileFromFile ();
|
||||||
}
|
}
|
||||||
_ACEOF
|
_ACEOF
|
||||||
if ac_fn_c_try_link "$LINENO"; then :
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
ac_cv_lib_lcms_cmsOpenProfileFromFile=yes
|
ac_cv_lib_lcms2_cmsOpenProfileFromFile=yes
|
||||||
else
|
else
|
||||||
ac_cv_lib_lcms_cmsOpenProfileFromFile=no
|
ac_cv_lib_lcms2_cmsOpenProfileFromFile=no
|
||||||
fi
|
fi
|
||||||
rm -f core conftest.err conftest.$ac_objext \
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
conftest$ac_exeext conftest.$ac_ext
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
LIBS=$ac_check_lib_save_LIBS
|
LIBS=$ac_check_lib_save_LIBS
|
||||||
fi
|
fi
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lcms_cmsOpenProfileFromFile" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lcms2_cmsOpenProfileFromFile" >&5
|
||||||
$as_echo "$ac_cv_lib_lcms_cmsOpenProfileFromFile" >&6; }
|
$as_echo "$ac_cv_lib_lcms2_cmsOpenProfileFromFile" >&6; }
|
||||||
if test "x$ac_cv_lib_lcms_cmsOpenProfileFromFile" = xyes; then :
|
if test "x$ac_cv_lib_lcms2_cmsOpenProfileFromFile" = xyes; then :
|
||||||
|
|
||||||
$as_echo "#define HAVE_LCMS 1" >>confdefs.h
|
$as_echo "#define HAVE_LCMS2 1" >>confdefs.h
|
||||||
|
|
||||||
else
|
else
|
||||||
LCMS_LIBS=""
|
LCMS2_LIBS=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
LCMS_CFLAGS=""
|
LCMS2_CFLAGS=""
|
||||||
LCMS_LIBS=""
|
LCMS2_LIBS=""
|
||||||
fi
|
fi
|
||||||
CPPFLAGS="$ac_save_CPPFLAGS"
|
CPPFLAGS="$ac_save_CPPFLAGS"
|
||||||
fi
|
fi
|
||||||
if test "$ac_cv_lib_lcms_cmsOpenProfileFromFile" != "yes"; then :
|
if test "$ac_cv_lib_lcms2_cmsOpenProfileFromFile" != "yes"; then :
|
||||||
case "x$with_cms" in
|
case "x$with_cms" in
|
||||||
x) as_fn_append wine_notices "|liblcms ${notice_platform}development files not found, Color Management won't be supported." ;;
|
x) as_fn_append wine_notices "|liblcms2 ${notice_platform}development files not found, Color Management won't be supported." ;;
|
||||||
xno) ;;
|
xno) ;;
|
||||||
*) as_fn_error $? "liblcms ${notice_platform}development files not found, Color Management won't be supported.
|
*) as_fn_error $? "liblcms2 ${notice_platform}development files not found, Color Management won't be supported.
|
||||||
This is an error since --with-cms was requested." "$LINENO" 5 ;;
|
This is an error since --with-cms was requested." "$LINENO" 5 ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
20
configure.ac
20
configure.ac
|
@ -1441,23 +1441,23 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl **** Check for LittleCMS ***
|
dnl **** Check for LittleCMS ***
|
||||||
if test "x$with_lcms" != "xno"
|
if test "x$with_lcms2" != "xno"
|
||||||
then
|
then
|
||||||
ac_save_CPPFLAGS="$CPPFLAGS"
|
ac_save_CPPFLAGS="$CPPFLAGS"
|
||||||
WINE_PACKAGE_FLAGS(LCMS,[lcms],[-llcms])
|
WINE_PACKAGE_FLAGS(LCMS2,[lcms2],[-llcms2])
|
||||||
AC_CHECK_HEADERS([lcms.h lcms/lcms.h])
|
AC_CHECK_HEADERS([lcms2.h])
|
||||||
if test "$ac_cv_header_lcms_h" = "yes" -o "$ac_cv_header_lcms_lcms_h" = "yes"
|
if test "$ac_cv_header_lcms2_h" = "yes"
|
||||||
then
|
then
|
||||||
AC_CHECK_LIB(lcms, cmsOpenProfileFromFile,
|
AC_CHECK_LIB(lcms2, cmsOpenProfileFromFile,
|
||||||
[AC_DEFINE(HAVE_LCMS, 1, [Define if you have the LittleCMS development environment])],[LCMS_LIBS=""])
|
[AC_DEFINE(HAVE_LCMS2, 1, [Define if you have the LittleCMS development environment])],[LCMS2_LIBS=""])
|
||||||
else
|
else
|
||||||
LCMS_CFLAGS=""
|
LCMS2_CFLAGS=""
|
||||||
LCMS_LIBS=""
|
LCMS2_LIBS=""
|
||||||
fi
|
fi
|
||||||
CPPFLAGS="$ac_save_CPPFLAGS"
|
CPPFLAGS="$ac_save_CPPFLAGS"
|
||||||
fi
|
fi
|
||||||
WINE_NOTICE_WITH(cms,[test "$ac_cv_lib_lcms_cmsOpenProfileFromFile" != "yes"],
|
WINE_NOTICE_WITH(cms,[test "$ac_cv_lib_lcms2_cmsOpenProfileFromFile" != "yes"],
|
||||||
[liblcms ${notice_platform}development files not found, Color Management won't be supported.])
|
[liblcms2 ${notice_platform}development files not found, Color Management won't be supported.])
|
||||||
|
|
||||||
dnl **** Check for FreeType 2 ****
|
dnl **** Check for FreeType 2 ****
|
||||||
if test "x$with_freetype" != "xno"
|
if test "x$with_freetype" != "xno"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
MODULE = mscms.dll
|
MODULE = mscms.dll
|
||||||
IMPORTLIB = mscms
|
IMPORTLIB = mscms
|
||||||
IMPORTS = shlwapi advapi32
|
IMPORTS = shlwapi advapi32
|
||||||
EXTRAINCL = @LCMS_CFLAGS@
|
EXTRAINCL = @LCMS2_CFLAGS@
|
||||||
EXTRALIBS = @LCMS_LIBS@
|
EXTRALIBS = @LCMS2_LIBS@
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
handle.c \
|
handle.c \
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
#include "mscms_priv.h"
|
#include "mscms_priv.h"
|
||||||
|
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
|
|
||||||
static CRITICAL_SECTION MSCMS_handle_cs;
|
static CRITICAL_SECTION MSCMS_handle_cs;
|
||||||
static CRITICAL_SECTION_DEBUG MSCMS_handle_cs_debug =
|
static CRITICAL_SECTION_DEBUG MSCMS_handle_cs_debug =
|
||||||
|
@ -112,7 +112,7 @@ static HPROFILE alloc_profile_handle( void )
|
||||||
|
|
||||||
for (index = 0; index < num_profile_handles; index++)
|
for (index = 0; index < num_profile_handles; index++)
|
||||||
{
|
{
|
||||||
if (!profiletable[index].iccprofile) return (HPROFILE)(index + 1);
|
if (!profiletable[index].data) return (HPROFILE)(index + 1);
|
||||||
}
|
}
|
||||||
if (!profiletable)
|
if (!profiletable)
|
||||||
{
|
{
|
||||||
|
@ -165,11 +165,11 @@ BOOL close_profile( HPROFILE handle )
|
||||||
{
|
{
|
||||||
if (profile->access & PROFILE_READWRITE)
|
if (profile->access & PROFILE_READWRITE)
|
||||||
{
|
{
|
||||||
DWORD written, size = MSCMS_get_profile_size( profile->iccprofile );
|
DWORD written;
|
||||||
|
|
||||||
if (SetFilePointer( profile->file, 0, NULL, FILE_BEGIN ) ||
|
if (SetFilePointer( profile->file, 0, NULL, FILE_BEGIN ) ||
|
||||||
!WriteFile( profile->file, profile->iccprofile, size, &written, NULL ) ||
|
!WriteFile( profile->file, profile->data, profile->size, &written, NULL ) ||
|
||||||
written != size)
|
written != profile->size)
|
||||||
{
|
{
|
||||||
ERR( "Unable to write color profile\n" );
|
ERR( "Unable to write color profile\n" );
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ BOOL close_profile( HPROFILE handle )
|
||||||
CloseHandle( profile->file );
|
CloseHandle( profile->file );
|
||||||
}
|
}
|
||||||
cmsCloseProfile( profile->cmsprofile );
|
cmsCloseProfile( profile->cmsprofile );
|
||||||
HeapFree( GetProcessHeap(), 0, profile->iccprofile );
|
HeapFree( GetProcessHeap(), 0, profile->data );
|
||||||
|
|
||||||
memset( profile, 0, sizeof(struct profile) );
|
memset( profile, 0, sizeof(struct profile) );
|
||||||
|
|
||||||
|
@ -249,4 +249,4 @@ BOOL close_transform( HTRANSFORM handle )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
|
|
|
@ -31,75 +31,90 @@
|
||||||
|
|
||||||
#include "mscms_priv.h"
|
#include "mscms_priv.h"
|
||||||
|
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
|
|
||||||
static inline void MSCMS_adjust_endianness32( ULONG *ptr )
|
static inline void adjust_endianness32( ULONG *ptr )
|
||||||
{
|
{
|
||||||
#ifndef WORDS_BIGENDIAN
|
#ifndef WORDS_BIGENDIAN
|
||||||
*ptr = RtlUlongByteSwap(*ptr);
|
*ptr = RtlUlongByteSwap(*ptr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSCMS_get_profile_header( const icProfile *iccprofile, PROFILEHEADER *header )
|
void get_profile_header( const struct profile *profile, PROFILEHEADER *header )
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
memcpy( header, iccprofile, sizeof(PROFILEHEADER) );
|
memcpy( header, profile->data, sizeof(PROFILEHEADER) );
|
||||||
|
|
||||||
/* ICC format is big-endian, swap bytes if necessary */
|
/* ICC format is big-endian, swap bytes if necessary */
|
||||||
for (i = 0; i < sizeof(PROFILEHEADER) / sizeof(ULONG); i++)
|
for (i = 0; i < sizeof(PROFILEHEADER) / sizeof(ULONG); i++)
|
||||||
MSCMS_adjust_endianness32( (ULONG *)header + i );
|
adjust_endianness32( (ULONG *)header + i );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSCMS_set_profile_header( icProfile *iccprofile, const PROFILEHEADER *header )
|
void set_profile_header( const struct profile *profile, const PROFILEHEADER *header )
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
icHeader *iccheader = (icHeader *)iccprofile;
|
|
||||||
|
|
||||||
memcpy( iccheader, header, sizeof(icHeader) );
|
memcpy( profile->data, header, sizeof(PROFILEHEADER) );
|
||||||
|
|
||||||
/* ICC format is big-endian, swap bytes if necessary */
|
/* ICC format is big-endian, swap bytes if necessary */
|
||||||
for (i = 0; i < sizeof(icHeader) / sizeof(ULONG); i++)
|
for (i = 0; i < sizeof(PROFILEHEADER) / sizeof(ULONG); i++)
|
||||||
MSCMS_adjust_endianness32( (ULONG *)iccheader + i );
|
adjust_endianness32( (ULONG *)profile->data + i );
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD MSCMS_get_tag_count( const icProfile *iccprofile )
|
static BOOL get_adjusted_tag( const struct profile *profile, TAGTYPE type, cmsTagEntry *tag )
|
||||||
{
|
{
|
||||||
ULONG count = iccprofile->count;
|
DWORD i, num_tags = *(DWORD *)(profile->data + sizeof(cmsICCHeader));
|
||||||
|
cmsTagEntry *entry;
|
||||||
|
ULONG sig;
|
||||||
|
|
||||||
MSCMS_adjust_endianness32( &count );
|
adjust_endianness32( &num_tags );
|
||||||
return count;
|
for (i = 0; i < num_tags; i++)
|
||||||
|
{
|
||||||
|
entry = (cmsTagEntry *)(profile->data + sizeof(cmsICCHeader) + sizeof(DWORD) + i * sizeof(*tag));
|
||||||
|
sig = entry->sig;
|
||||||
|
adjust_endianness32( &sig );
|
||||||
|
if (sig == type)
|
||||||
|
{
|
||||||
|
tag->sig = sig;
|
||||||
|
tag->offset = entry->offset;
|
||||||
|
tag->size = entry->size;
|
||||||
|
adjust_endianness32( &tag->offset );
|
||||||
|
adjust_endianness32( &tag->size );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSCMS_get_tag_by_index( icProfile *iccprofile, DWORD index, icTag *tag )
|
BOOL get_tag_data( const struct profile *profile, TAGTYPE type, DWORD offset, void *buffer, DWORD *len )
|
||||||
{
|
{
|
||||||
icTag *tmp = (icTag *)((char *)iccprofile->data + index * sizeof(icTag));
|
cmsTagEntry tag;
|
||||||
|
|
||||||
tag->sig = tmp->sig;
|
if (!get_adjusted_tag( profile, type, &tag )) return FALSE;
|
||||||
tag->offset = tmp->offset;
|
|
||||||
tag->size = tmp->size;
|
|
||||||
|
|
||||||
MSCMS_adjust_endianness32( &tag->sig );
|
if (!buffer) offset = 0;
|
||||||
MSCMS_adjust_endianness32( &tag->offset );
|
if (offset > tag.size) return FALSE;
|
||||||
MSCMS_adjust_endianness32( &tag->size );
|
if (*len < tag.size - offset || !buffer)
|
||||||
|
{
|
||||||
|
*len = tag.size - offset;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
memcpy( buffer, profile->data + tag.offset + offset, tag.size - offset );
|
||||||
|
*len = tag.size - offset;
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSCMS_get_tag_data( const icProfile *iccprofile, const icTag *tag, DWORD offset, void *buffer )
|
BOOL set_tag_data( const struct profile *profile, TAGTYPE type, DWORD offset, const void *buffer, DWORD *len )
|
||||||
{
|
{
|
||||||
memcpy( buffer, (const char *)iccprofile + tag->offset + offset, tag->size - offset );
|
cmsTagEntry tag;
|
||||||
|
|
||||||
|
if (!get_adjusted_tag( profile, type, &tag )) return FALSE;
|
||||||
|
|
||||||
|
if (offset > tag.size) return FALSE;
|
||||||
|
*len = min( tag.size - offset, *len );
|
||||||
|
memcpy( profile->data + tag.offset + offset, buffer, *len );
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSCMS_set_tag_data( icProfile *iccprofile, const icTag *tag, DWORD offset, const void *buffer )
|
#endif /* HAVE_LCMS2 */
|
||||||
{
|
|
||||||
memcpy( (char *)iccprofile + tag->offset + offset, buffer, tag->size - offset );
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD MSCMS_get_profile_size( const icProfile *iccprofile )
|
|
||||||
{
|
|
||||||
DWORD size = ((const icHeader *)iccprofile)->size;
|
|
||||||
|
|
||||||
MSCMS_adjust_endianness32( &size );
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* HAVE_LCMS */
|
|
||||||
|
|
|
@ -36,20 +36,10 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(mscms);
|
WINE_DEFAULT_DEBUG_CHANNEL(mscms);
|
||||||
|
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
static int lcms_error_handler( int error, const char *text )
|
static void lcms_error_handler(cmsContext ctx, cmsUInt32Number error, const char *text)
|
||||||
{
|
{
|
||||||
switch (error)
|
TRACE("%u %s\n", error, debugstr_a(text));
|
||||||
{
|
|
||||||
case LCMS_ERRC_WARNING:
|
|
||||||
case LCMS_ERRC_RECOVERABLE:
|
|
||||||
case LCMS_ERRC_ABORTED:
|
|
||||||
WARN("%d %s\n", error, debugstr_a(text));
|
|
||||||
return 1;
|
|
||||||
default:
|
|
||||||
ERR("unknown error %d %s\n", error, debugstr_a(text));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -61,13 +51,13 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
|
||||||
{
|
{
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
DisableThreadLibraryCalls( hinst );
|
DisableThreadLibraryCalls( hinst );
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
cmsSetErrorHandler( lcms_error_handler );
|
cmsSetLogErrorHandler( lcms_error_handler );
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case DLL_PROCESS_DETACH:
|
case DLL_PROCESS_DETACH:
|
||||||
if (reserved) break;
|
if (reserved) break;
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
free_handle_tables();
|
free_handle_tables();
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -18,54 +18,8 @@
|
||||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
|
#include <lcms2.h>
|
||||||
/* These basic Windows types are defined in lcms.h when compiling on
|
|
||||||
* a non-Windows platform (why?), so they would normally not conflict
|
|
||||||
* with anything included earlier. But since we are building Wine they
|
|
||||||
* most certainly will have been defined before we include lcms.h.
|
|
||||||
* The preprocessor comes to the rescue.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define BYTE LCMS_BYTE
|
|
||||||
#define LPBYTE LCMS_LPBYTE
|
|
||||||
#define WORD LCMS_WORD
|
|
||||||
#define LPWORD LCMS_LPWORD
|
|
||||||
#define DWORD LCMS_DWORD
|
|
||||||
#define LPDWORD LCMS_LPDWORD
|
|
||||||
#define BOOL LCMS_BOOL
|
|
||||||
#define LPSTR LCMS_LPSTR
|
|
||||||
#define LPVOID LCMS_LPVOID
|
|
||||||
|
|
||||||
#undef cdecl
|
|
||||||
#undef FAR
|
|
||||||
|
|
||||||
#undef ZeroMemory
|
|
||||||
#undef CopyMemory
|
|
||||||
|
|
||||||
#undef LOWORD
|
|
||||||
#undef HIWORD
|
|
||||||
#undef MAX_PATH
|
|
||||||
|
|
||||||
#ifdef HAVE_LCMS_LCMS_H
|
|
||||||
#include <lcms/lcms.h>
|
|
||||||
#else
|
|
||||||
#include <lcms.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Funny thing is lcms.h defines DWORD as an 'unsigned long' whereas Wine
|
|
||||||
* defines it as an 'unsigned int'. To avoid compiler warnings we use a
|
|
||||||
* preprocessor define for DWORD and LPDWORD to get back Wine's original
|
|
||||||
* (typedef) definitions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#undef BOOL
|
|
||||||
#undef DWORD
|
|
||||||
#undef LPDWORD
|
|
||||||
|
|
||||||
#define BOOL BOOL
|
|
||||||
#define DWORD DWORD
|
|
||||||
#define LPDWORD LPDWORD
|
|
||||||
|
|
||||||
/* A simple structure to tie together a pointer to an icc profile, an lcms
|
/* A simple structure to tie together a pointer to an icc profile, an lcms
|
||||||
* color profile handle and a Windows file handle. If the profile is memory
|
* color profile handle and a Windows file handle. If the profile is memory
|
||||||
|
@ -76,9 +30,10 @@
|
||||||
|
|
||||||
struct profile
|
struct profile
|
||||||
{
|
{
|
||||||
HANDLE file;
|
HANDLE file;
|
||||||
DWORD access;
|
DWORD access;
|
||||||
icProfile *iccprofile;
|
char *data;
|
||||||
|
DWORD size;
|
||||||
cmsHPROFILE cmsprofile;
|
cmsHPROFILE cmsprofile;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -101,14 +56,11 @@ void release_transform( struct transform * ) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
extern void free_handle_tables( void ) DECLSPEC_HIDDEN;
|
extern void free_handle_tables( void ) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
extern DWORD MSCMS_get_tag_count( const icProfile *iccprofile ) DECLSPEC_HIDDEN;
|
extern BOOL get_tag_data( const struct profile *, TAGTYPE, DWORD, void *, DWORD * ) DECLSPEC_HIDDEN;
|
||||||
extern void MSCMS_get_tag_by_index( icProfile *iccprofile, DWORD index, icTag *tag ) DECLSPEC_HIDDEN;
|
extern BOOL set_tag_data( const struct profile *, TAGTYPE, DWORD, const void *, DWORD * ) DECLSPEC_HIDDEN;
|
||||||
extern void MSCMS_get_tag_data( const icProfile *iccprofile, const icTag *tag, DWORD offset, void *buffer ) DECLSPEC_HIDDEN;
|
extern void get_profile_header( const struct profile *, PROFILEHEADER * ) DECLSPEC_HIDDEN;
|
||||||
extern void MSCMS_set_tag_data( icProfile *iccprofile, const icTag *tag, DWORD offset, const void *buffer ) DECLSPEC_HIDDEN;
|
extern void set_profile_header( const struct profile *, const PROFILEHEADER * ) DECLSPEC_HIDDEN;
|
||||||
extern void MSCMS_get_profile_header( const icProfile *iccprofile, PROFILEHEADER *header ) DECLSPEC_HIDDEN;
|
|
||||||
extern void MSCMS_set_profile_header( icProfile *iccprofile, const PROFILEHEADER *header ) DECLSPEC_HIDDEN;
|
|
||||||
extern DWORD MSCMS_get_profile_size( const icProfile *iccprofile ) DECLSPEC_HIDDEN;
|
|
||||||
|
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
|
|
||||||
extern const char *MSCMS_dbgstr_tag(DWORD) DECLSPEC_HIDDEN;
|
extern const char *MSCMS_dbgstr_tag(DWORD) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -337,10 +337,8 @@ BOOL WINAPI GetColorProfileElement( HPROFILE handle, TAGTYPE type, DWORD offset,
|
||||||
PVOID buffer, PBOOL ref )
|
PVOID buffer, PBOOL ref )
|
||||||
{
|
{
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
struct profile *profile = grab_profile( handle );
|
struct profile *profile = grab_profile( handle );
|
||||||
DWORD i, count;
|
|
||||||
icTag tag;
|
|
||||||
|
|
||||||
TRACE( "( %p, 0x%08x, %d, %p, %p, %p )\n", handle, type, offset, size, buffer, ref );
|
TRACE( "( %p, 0x%08x, %d, %p, %p, %p )\n", handle, type, offset, size, buffer, ref );
|
||||||
|
|
||||||
|
@ -351,30 +349,17 @@ BOOL WINAPI GetColorProfileElement( HPROFILE handle, TAGTYPE type, DWORD offset,
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
count = MSCMS_get_tag_count( profile->iccprofile );
|
if (!get_tag_data( profile, type, offset, buffer, size ))
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
{
|
||||||
MSCMS_get_tag_by_index( profile->iccprofile, i, &tag );
|
release_profile( profile );
|
||||||
|
return FALSE;
|
||||||
if (tag.sig == type)
|
|
||||||
{
|
|
||||||
if ((tag.size - offset) > *size || !buffer)
|
|
||||||
{
|
|
||||||
*size = (tag.size - offset);
|
|
||||||
release_profile( profile );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
MSCMS_get_tag_data( profile->iccprofile, &tag, offset, buffer );
|
|
||||||
|
|
||||||
*ref = FALSE; /* FIXME: calculate properly */
|
|
||||||
release_profile( profile );
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
ret = get_tag_data( profile, type, offset, buffer, size );
|
||||||
|
*ref = cmsTagLinkedTo( profile->cmsprofile, type ) != 0;
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
|
return ret;
|
||||||
|
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,10 +384,10 @@ BOOL WINAPI GetColorProfileElement( HPROFILE handle, TAGTYPE type, DWORD offset,
|
||||||
BOOL WINAPI GetColorProfileElementTag( HPROFILE handle, DWORD index, PTAGTYPE type )
|
BOOL WINAPI GetColorProfileElementTag( HPROFILE handle, DWORD index, PTAGTYPE type )
|
||||||
{
|
{
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
struct profile *profile = grab_profile( handle );
|
struct profile *profile = grab_profile( handle );
|
||||||
DWORD count;
|
cmsInt32Number num_tags;
|
||||||
icTag tag;
|
cmsTagSignature sig;
|
||||||
|
|
||||||
TRACE( "( %p, %d, %p )\n", handle, index, type );
|
TRACE( "( %p, %d, %p )\n", handle, index, type );
|
||||||
|
|
||||||
|
@ -413,19 +398,20 @@ BOOL WINAPI GetColorProfileElementTag( HPROFILE handle, DWORD index, PTAGTYPE ty
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
count = MSCMS_get_tag_count( profile->iccprofile );
|
num_tags = cmsGetTagCount( profile->cmsprofile );
|
||||||
if (index > count || index < 1)
|
if (num_tags < 0 || index > num_tags || index < 1)
|
||||||
{
|
{
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
MSCMS_get_tag_by_index( profile->iccprofile, index - 1, &tag );
|
if ((sig = cmsGetTagSignature( profile->cmsprofile, index - 1 )))
|
||||||
*type = tag.sig;
|
{
|
||||||
|
*type = sig;
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
ret = TRUE;
|
|
||||||
|
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,7 +436,7 @@ BOOL WINAPI GetColorProfileElementTag( HPROFILE handle, DWORD index, PTAGTYPE ty
|
||||||
BOOL WINAPI GetColorProfileFromHandle( HPROFILE handle, PBYTE buffer, PDWORD size )
|
BOOL WINAPI GetColorProfileFromHandle( HPROFILE handle, PBYTE buffer, PDWORD size )
|
||||||
{
|
{
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
struct profile *profile = grab_profile( handle );
|
struct profile *profile = grab_profile( handle );
|
||||||
PROFILEHEADER header;
|
PROFILEHEADER header;
|
||||||
|
|
||||||
|
@ -463,7 +449,7 @@ BOOL WINAPI GetColorProfileFromHandle( HPROFILE handle, PBYTE buffer, PDWORD siz
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
MSCMS_get_profile_header( profile->iccprofile, &header );
|
get_profile_header( profile, &header );
|
||||||
|
|
||||||
if (!buffer || header.phSize > *size)
|
if (!buffer || header.phSize > *size)
|
||||||
{
|
{
|
||||||
|
@ -473,13 +459,13 @@ BOOL WINAPI GetColorProfileFromHandle( HPROFILE handle, PBYTE buffer, PDWORD siz
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No endian conversion needed */
|
/* No endian conversion needed */
|
||||||
memcpy( buffer, profile->iccprofile, header.phSize );
|
memcpy( buffer, profile->data, profile->size );
|
||||||
*size = header.phSize;
|
*size = profile->size;
|
||||||
|
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,7 +487,7 @@ BOOL WINAPI GetColorProfileFromHandle( HPROFILE handle, PBYTE buffer, PDWORD siz
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI GetColorProfileHeader( HPROFILE handle, PPROFILEHEADER header )
|
BOOL WINAPI GetColorProfileHeader( HPROFILE handle, PPROFILEHEADER header )
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
struct profile *profile = grab_profile( handle );
|
struct profile *profile = grab_profile( handle );
|
||||||
|
|
||||||
TRACE( "( %p, %p )\n", handle, header );
|
TRACE( "( %p, %p )\n", handle, header );
|
||||||
|
@ -513,14 +499,13 @@ BOOL WINAPI GetColorProfileHeader( HPROFILE handle, PPROFILEHEADER header )
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
MSCMS_get_profile_header( profile->iccprofile, header );
|
get_profile_header( profile, header );
|
||||||
|
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -540,8 +525,9 @@ BOOL WINAPI GetColorProfileHeader( HPROFILE handle, PPROFILEHEADER header )
|
||||||
BOOL WINAPI GetCountColorProfileElements( HPROFILE handle, PDWORD count )
|
BOOL WINAPI GetCountColorProfileElements( HPROFILE handle, PDWORD count )
|
||||||
{
|
{
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
struct profile *profile = grab_profile( handle );
|
struct profile *profile = grab_profile( handle );
|
||||||
|
cmsInt32Number num_tags;
|
||||||
|
|
||||||
TRACE( "( %p, %p )\n", handle, count );
|
TRACE( "( %p, %p )\n", handle, count );
|
||||||
|
|
||||||
|
@ -552,12 +538,14 @@ BOOL WINAPI GetCountColorProfileElements( HPROFILE handle, PDWORD count )
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
*count = MSCMS_get_tag_count( profile->iccprofile );
|
if ((num_tags = cmsGetTagCount( profile->cmsprofile )) >= 0)
|
||||||
|
{
|
||||||
|
*count = num_tags;
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
ret = TRUE;
|
|
||||||
|
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1156,10 +1144,8 @@ BOOL WINAPI InstallColorProfileW( PCWSTR machine, PCWSTR profile )
|
||||||
BOOL WINAPI IsColorProfileTagPresent( HPROFILE handle, TAGTYPE type, PBOOL present )
|
BOOL WINAPI IsColorProfileTagPresent( HPROFILE handle, TAGTYPE type, PBOOL present )
|
||||||
{
|
{
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
struct profile *profile = grab_profile( handle );
|
struct profile *profile = grab_profile( handle );
|
||||||
DWORD i, count;
|
|
||||||
icTag tag;
|
|
||||||
|
|
||||||
TRACE( "( %p, 0x%08x, %p )\n", handle, type, present );
|
TRACE( "( %p, 0x%08x, %p )\n", handle, type, present );
|
||||||
|
|
||||||
|
@ -1170,21 +1156,11 @@ BOOL WINAPI IsColorProfileTagPresent( HPROFILE handle, TAGTYPE type, PBOOL prese
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
count = MSCMS_get_tag_count( profile->iccprofile );
|
*present = cmsIsTag( profile->cmsprofile, type );
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
MSCMS_get_tag_by_index( profile->iccprofile, i, &tag );
|
|
||||||
|
|
||||||
if (tag.sig == type)
|
|
||||||
{
|
|
||||||
*present = ret = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
|
ret = TRUE;
|
||||||
|
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1205,7 +1181,7 @@ BOOL WINAPI IsColorProfileTagPresent( HPROFILE handle, TAGTYPE type, PBOOL prese
|
||||||
BOOL WINAPI IsColorProfileValid( HPROFILE handle, PBOOL valid )
|
BOOL WINAPI IsColorProfileValid( HPROFILE handle, PBOOL valid )
|
||||||
{
|
{
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
struct profile *profile = grab_profile( handle );
|
struct profile *profile = grab_profile( handle );
|
||||||
|
|
||||||
TRACE( "( %p, %p )\n", handle, valid );
|
TRACE( "( %p, %p )\n", handle, valid );
|
||||||
|
@ -1217,10 +1193,10 @@ BOOL WINAPI IsColorProfileValid( HPROFILE handle, PBOOL valid )
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (profile->iccprofile) ret = *valid = TRUE;
|
if (profile->data) ret = *valid = TRUE;
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
|
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1245,10 +1221,8 @@ BOOL WINAPI SetColorProfileElement( HPROFILE handle, TAGTYPE type, DWORD offset,
|
||||||
PVOID buffer )
|
PVOID buffer )
|
||||||
{
|
{
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
struct profile *profile = grab_profile( handle );
|
struct profile *profile = grab_profile( handle );
|
||||||
DWORD i, count;
|
|
||||||
icTag tag;
|
|
||||||
|
|
||||||
TRACE( "( %p, 0x%08x, %d, %p, %p )\n", handle, type, offset, size, buffer );
|
TRACE( "( %p, 0x%08x, %d, %p, %p )\n", handle, type, offset, size, buffer );
|
||||||
|
|
||||||
|
@ -1259,28 +1233,11 @@ BOOL WINAPI SetColorProfileElement( HPROFILE handle, TAGTYPE type, DWORD offset,
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
count = MSCMS_get_tag_count( profile->iccprofile );
|
ret = set_tag_data( profile, type, offset, buffer, size );
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
MSCMS_get_tag_by_index( profile->iccprofile, i, &tag );
|
|
||||||
|
|
||||||
if (tag.sig == type)
|
|
||||||
{
|
|
||||||
if (offset > tag.size)
|
|
||||||
{
|
|
||||||
release_profile( profile );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
MSCMS_set_tag_data( profile->iccprofile, &tag, offset, buffer );
|
|
||||||
|
|
||||||
release_profile( profile );
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
|
return ret;
|
||||||
|
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1299,7 +1256,7 @@ BOOL WINAPI SetColorProfileElement( HPROFILE handle, TAGTYPE type, DWORD offset,
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI SetColorProfileHeader( HPROFILE handle, PPROFILEHEADER header )
|
BOOL WINAPI SetColorProfileHeader( HPROFILE handle, PPROFILEHEADER header )
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
struct profile *profile = grab_profile( handle );
|
struct profile *profile = grab_profile( handle );
|
||||||
|
|
||||||
TRACE( "( %p, %p )\n", handle, header );
|
TRACE( "( %p, %p )\n", handle, header );
|
||||||
|
@ -1311,14 +1268,13 @@ BOOL WINAPI SetColorProfileHeader( HPROFILE handle, PPROFILEHEADER header )
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
MSCMS_set_profile_header( profile->iccprofile, header );
|
set_profile_header( profile, header );
|
||||||
|
|
||||||
release_profile( profile );
|
release_profile( profile );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -1439,10 +1395,11 @@ HPROFILE WINAPI OpenColorProfileA( PPROFILE profile, DWORD access, DWORD sharing
|
||||||
*/
|
*/
|
||||||
HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing, DWORD creation )
|
HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing, DWORD creation )
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
cmsHPROFILE cmsprofile = NULL;
|
cmsHPROFILE cmsprofile = NULL;
|
||||||
icProfile *iccprofile = NULL;
|
char *data = NULL;
|
||||||
HANDLE handle = INVALID_HANDLE_VALUE;
|
HANDLE handle = INVALID_HANDLE_VALUE;
|
||||||
|
DWORD size;
|
||||||
|
|
||||||
TRACE( "( %p, 0x%08x, 0x%08x, 0x%08x )\n", profile, access, sharing, creation );
|
TRACE( "( %p, 0x%08x, 0x%08x, 0x%08x )\n", profile, access, sharing, creation );
|
||||||
|
|
||||||
|
@ -1452,14 +1409,15 @@ HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing
|
||||||
{
|
{
|
||||||
/* FIXME: access flags not implemented for memory based profiles */
|
/* FIXME: access flags not implemented for memory based profiles */
|
||||||
|
|
||||||
if (!(iccprofile = HeapAlloc( GetProcessHeap(), 0, profile->cbDataSize ))) return NULL;
|
if (!(data = HeapAlloc( GetProcessHeap(), 0, profile->cbDataSize ))) return NULL;
|
||||||
memcpy( iccprofile, profile->pProfileData, profile->cbDataSize );
|
memcpy( data, profile->pProfileData, profile->cbDataSize );
|
||||||
|
|
||||||
cmsprofile = cmsOpenProfileFromMem( iccprofile, profile->cbDataSize );
|
cmsprofile = cmsOpenProfileFromMem( data, profile->cbDataSize );
|
||||||
|
size = profile->cbDataSize;
|
||||||
}
|
}
|
||||||
else if (profile->dwType == PROFILE_FILENAME)
|
else if (profile->dwType == PROFILE_FILENAME)
|
||||||
{
|
{
|
||||||
DWORD size, read, flags = 0;
|
DWORD read, flags = 0;
|
||||||
|
|
||||||
TRACE( "profile file: %s\n", debugstr_w( profile->pProfileData ) );
|
TRACE( "profile file: %s\n", debugstr_w( profile->pProfileData ) );
|
||||||
|
|
||||||
|
@ -1492,32 +1450,27 @@ HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing
|
||||||
WARN( "Unable to open color profile %u\n", GetLastError() );
|
WARN( "Unable to open color profile %u\n", GetLastError() );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size = GetFileSize( handle, NULL )) == INVALID_FILE_SIZE)
|
if ((size = GetFileSize( handle, NULL )) == INVALID_FILE_SIZE)
|
||||||
{
|
{
|
||||||
ERR( "Unable to retrieve size of color profile\n" );
|
ERR( "Unable to retrieve size of color profile\n" );
|
||||||
CloseHandle( handle );
|
CloseHandle( handle );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (!(data = HeapAlloc( GetProcessHeap(), 0, size )))
|
||||||
iccprofile = HeapAlloc( GetProcessHeap(), 0, size );
|
|
||||||
if (!iccprofile)
|
|
||||||
{
|
{
|
||||||
ERR( "Unable to allocate memory for color profile\n" );
|
ERR( "Unable to allocate memory for color profile\n" );
|
||||||
CloseHandle( handle );
|
CloseHandle( handle );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (!ReadFile( handle, data, size, &read, NULL ) || read != size)
|
||||||
if (!ReadFile( handle, iccprofile, size, &read, NULL ) || read != size)
|
|
||||||
{
|
{
|
||||||
ERR( "Unable to read color profile\n" );
|
ERR( "Unable to read color profile\n" );
|
||||||
|
|
||||||
CloseHandle( handle );
|
CloseHandle( handle );
|
||||||
HeapFree( GetProcessHeap(), 0, iccprofile );
|
HeapFree( GetProcessHeap(), 0, data );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
cmsprofile = cmsOpenProfileFromMem( data, size );
|
||||||
cmsprofile = cmsOpenProfileFromMem( iccprofile, size );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1530,18 +1483,19 @@ HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing
|
||||||
struct profile profile;
|
struct profile profile;
|
||||||
HPROFILE hprof;
|
HPROFILE hprof;
|
||||||
|
|
||||||
profile.file = handle;
|
profile.file = handle;
|
||||||
profile.access = access;
|
profile.access = access;
|
||||||
profile.iccprofile = iccprofile;
|
profile.data = data;
|
||||||
|
profile.size = size;
|
||||||
profile.cmsprofile = cmsprofile;
|
profile.cmsprofile = cmsprofile;
|
||||||
|
|
||||||
if ((hprof = create_profile( &profile ))) return hprof;
|
if ((hprof = create_profile( &profile ))) return hprof;
|
||||||
HeapFree( GetProcessHeap(), 0, iccprofile );
|
HeapFree( GetProcessHeap(), 0, data );
|
||||||
cmsCloseProfile( cmsprofile );
|
cmsCloseProfile( cmsprofile );
|
||||||
}
|
}
|
||||||
CloseHandle( handle );
|
CloseHandle( handle );
|
||||||
|
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1560,11 +1514,11 @@ HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing
|
||||||
BOOL WINAPI CloseColorProfile( HPROFILE profile )
|
BOOL WINAPI CloseColorProfile( HPROFILE profile )
|
||||||
{
|
{
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
|
|
||||||
TRACE( "( %p )\n", profile );
|
TRACE( "( %p )\n", profile );
|
||||||
ret = close_profile( profile );
|
ret = close_profile( profile );
|
||||||
|
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,17 +254,16 @@ static void test_GetColorProfileElement( char *standardprofile )
|
||||||
ok( !ret, "GetColorProfileElement() succeeded (%d)\n", GetLastError() );
|
ok( !ret, "GetColorProfileElement() succeeded (%d)\n", GetLastError() );
|
||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
|
|
||||||
ret = pGetColorProfileElement( handle, tag, 0, &size, NULL, &ref );
|
ret = pGetColorProfileElement( handle, tag, 0, &size, NULL, &ref );
|
||||||
ok( !ret && size > 0, "GetColorProfileElement() succeeded (%d)\n", GetLastError() );
|
ok( !ret, "GetColorProfileElement() succeeded\n" );
|
||||||
|
ok( size > 0, "wrong size\n" );
|
||||||
size = sizeof(buffer);
|
|
||||||
|
|
||||||
/* Functional checks */
|
/* Functional checks */
|
||||||
|
|
||||||
|
size = sizeof(buffer);
|
||||||
ret = pGetColorProfileElement( handle, tag, 0, &size, buffer, &ref );
|
ret = pGetColorProfileElement( handle, tag, 0, &size, buffer, &ref );
|
||||||
ok( ret && size > 0, "GetColorProfileElement() failed (%d)\n", GetLastError() );
|
ok( ret, "GetColorProfileElement() failed %u\n", GetLastError() );
|
||||||
|
ok( size > 0, "wrong size\n" );
|
||||||
ok( !memcmp( buffer, expect, sizeof(expect) ), "Unexpected tag data\n" );
|
ok( !memcmp( buffer, expect, sizeof(expect) ), "Unexpected tag data\n" );
|
||||||
|
|
||||||
pCloseColorProfile( handle );
|
pCloseColorProfile( handle );
|
||||||
|
@ -1054,18 +1053,16 @@ static void test_SetColorProfileElement( char *testprofile )
|
||||||
/* Functional checks */
|
/* Functional checks */
|
||||||
|
|
||||||
size = sizeof(data);
|
size = sizeof(data);
|
||||||
|
|
||||||
ret = pSetColorProfileElement( handle, tag, 0, &size, data );
|
ret = pSetColorProfileElement( handle, tag, 0, &size, data );
|
||||||
ok( ret, "SetColorProfileElement() failed (%d)\n", GetLastError() );
|
ok( ret, "SetColorProfileElement() failed %u\n", GetLastError() );
|
||||||
|
|
||||||
size = sizeof(buffer);
|
size = sizeof(buffer);
|
||||||
|
|
||||||
ret = pGetColorProfileElement( handle, tag, 0, &size, buffer, &ref );
|
ret = pGetColorProfileElement( handle, tag, 0, &size, buffer, &ref );
|
||||||
ok( ret && size > 0, "GetColorProfileElement() failed (%d)\n", GetLastError() );
|
ok( ret, "GetColorProfileElement() failed %u\n", GetLastError() );
|
||||||
|
ok( size > 0, "wrong size\n" );
|
||||||
|
|
||||||
ok( !memcmp( data, buffer, sizeof(data) ),
|
ok( !memcmp( data, buffer, sizeof(data) ),
|
||||||
"Unexpected tag data, expected %s, got %s (%d)\n",
|
"Unexpected tag data, expected %s, got %s (%u)\n", data, buffer, GetLastError() );
|
||||||
data, buffer, GetLastError() );
|
|
||||||
|
|
||||||
pCloseColorProfile( handle );
|
pCloseColorProfile( handle );
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(mscms);
|
WINE_DEFAULT_DEBUG_CHANNEL(mscms);
|
||||||
|
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
|
|
||||||
static DWORD from_profile( HPROFILE profile )
|
static DWORD from_profile( HPROFILE profile )
|
||||||
{
|
{
|
||||||
|
@ -96,7 +96,7 @@ static DWORD from_type( COLORTYPE type )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* CreateColorTransformA [MSCMS.@]
|
* CreateColorTransformA [MSCMS.@]
|
||||||
|
@ -141,7 +141,7 @@ HTRANSFORM WINAPI CreateColorTransformW( LPLOGCOLORSPACEW space, HPROFILE dest,
|
||||||
HPROFILE target, DWORD flags )
|
HPROFILE target, DWORD flags )
|
||||||
{
|
{
|
||||||
HTRANSFORM ret = NULL;
|
HTRANSFORM ret = NULL;
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
struct transform transform;
|
struct transform transform;
|
||||||
struct profile *dst, *tgt = NULL;
|
struct profile *dst, *tgt = NULL;
|
||||||
cmsHPROFILE cmsinput, cmsoutput, cmstarget = NULL;
|
cmsHPROFILE cmsinput, cmsoutput, cmstarget = NULL;
|
||||||
|
@ -181,7 +181,7 @@ HTRANSFORM WINAPI CreateColorTransformW( LPLOGCOLORSPACEW space, HPROFILE dest,
|
||||||
if (tgt) release_profile( tgt );
|
if (tgt) release_profile( tgt );
|
||||||
release_profile( dst );
|
release_profile( dst );
|
||||||
|
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ HTRANSFORM WINAPI CreateMultiProfileTransform( PHPROFILE profiles, DWORD nprofil
|
||||||
PDWORD intents, DWORD nintents, DWORD flags, DWORD cmm )
|
PDWORD intents, DWORD nintents, DWORD flags, DWORD cmm )
|
||||||
{
|
{
|
||||||
HTRANSFORM ret = NULL;
|
HTRANSFORM ret = NULL;
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
cmsHPROFILE *cmsprofiles, cmsconvert = NULL;
|
cmsHPROFILE *cmsprofiles, cmsconvert = NULL;
|
||||||
struct transform transform;
|
struct transform transform;
|
||||||
struct profile *profile0, *profile1;
|
struct profile *profile0, *profile1;
|
||||||
|
@ -237,7 +237,7 @@ HTRANSFORM WINAPI CreateMultiProfileTransform( PHPROFILE profiles, DWORD nprofil
|
||||||
{
|
{
|
||||||
/* insert a conversion profile for pairings that lcms doesn't handle */
|
/* insert a conversion profile for pairings that lcms doesn't handle */
|
||||||
if (out_format == TYPE_RGB_16) cmsconvert = cmsCreate_sRGBProfile();
|
if (out_format == TYPE_RGB_16) cmsconvert = cmsCreate_sRGBProfile();
|
||||||
if (out_format == TYPE_Lab_16) cmsconvert = cmsCreateLabProfile( NULL );
|
if (out_format == TYPE_Lab_16) cmsconvert = cmsCreateLab2Profile( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
cmsprofiles = HeapAlloc( GetProcessHeap(), 0, (nprofiles + 1) * sizeof(cmsHPROFILE) );
|
cmsprofiles = HeapAlloc( GetProcessHeap(), 0, (nprofiles + 1) * sizeof(cmsHPROFILE) );
|
||||||
|
@ -263,7 +263,7 @@ HTRANSFORM WINAPI CreateMultiProfileTransform( PHPROFILE profiles, DWORD nprofil
|
||||||
release_profile( profile0 );
|
release_profile( profile0 );
|
||||||
release_profile( profile1 );
|
release_profile( profile1 );
|
||||||
|
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,13 +282,13 @@ HTRANSFORM WINAPI CreateMultiProfileTransform( PHPROFILE profiles, DWORD nprofil
|
||||||
BOOL WINAPI DeleteColorTransform( HTRANSFORM handle )
|
BOOL WINAPI DeleteColorTransform( HTRANSFORM handle )
|
||||||
{
|
{
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
|
|
||||||
TRACE( "( %p )\n", handle );
|
TRACE( "( %p )\n", handle );
|
||||||
|
|
||||||
ret = close_transform( handle );
|
ret = close_transform( handle );
|
||||||
|
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ BOOL WINAPI TranslateBitmapBits( HTRANSFORM handle, PVOID srcbits, BMFORMAT inpu
|
||||||
DWORD outputstride, PBMCALLBACKFN callback, ULONG data )
|
DWORD outputstride, PBMCALLBACKFN callback, ULONG data )
|
||||||
{
|
{
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
struct transform *transform = grab_transform( handle );
|
struct transform *transform = grab_transform( handle );
|
||||||
|
|
||||||
TRACE( "( %p, %p, 0x%08x, 0x%08x, 0x%08x, 0x%08x, %p, 0x%08x, 0x%08x, %p, 0x%08x )\n",
|
TRACE( "( %p, %p, 0x%08x, 0x%08x, 0x%08x, 0x%08x, %p, 0x%08x, 0x%08x, %p, 0x%08x )\n",
|
||||||
|
@ -333,7 +333,7 @@ BOOL WINAPI TranslateBitmapBits( HTRANSFORM handle, PVOID srcbits, BMFORMAT inpu
|
||||||
release_transform( transform );
|
release_transform( transform );
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
|
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ BOOL WINAPI TranslateBitmapBits( HTRANSFORM handle, PVOID srcbits, BMFORMAT inpu
|
||||||
BOOL WINAPI TranslateColors( HTRANSFORM handle, PCOLOR in, DWORD count,
|
BOOL WINAPI TranslateColors( HTRANSFORM handle, PCOLOR in, DWORD count,
|
||||||
COLORTYPE input_type, PCOLOR out, COLORTYPE output_type )
|
COLORTYPE input_type, PCOLOR out, COLORTYPE output_type )
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LCMS
|
#ifdef HAVE_LCMS2
|
||||||
BOOL ret = TRUE;
|
BOOL ret = TRUE;
|
||||||
struct transform *transform = grab_transform( handle );
|
struct transform *transform = grab_transform( handle );
|
||||||
cmsHTRANSFORM xfrm;
|
cmsHTRANSFORM xfrm;
|
||||||
|
@ -462,7 +462,7 @@ done:
|
||||||
release_transform( transform );
|
release_transform( transform );
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
#else /* HAVE_LCMS */
|
#else /* HAVE_LCMS2 */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#endif /* HAVE_LCMS */
|
#endif /* HAVE_LCMS2 */
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,13 +303,10 @@
|
||||||
#undef HAVE_LBER_H
|
#undef HAVE_LBER_H
|
||||||
|
|
||||||
/* Define if you have the LittleCMS development environment */
|
/* Define if you have the LittleCMS development environment */
|
||||||
#undef HAVE_LCMS
|
#undef HAVE_LCMS2
|
||||||
|
|
||||||
/* Define to 1 if you have the <lcms.h> header file. */
|
/* Define to 1 if you have the <lcms2.h> header file. */
|
||||||
#undef HAVE_LCMS_H
|
#undef HAVE_LCMS2_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <lcms/lcms.h> header file. */
|
|
||||||
#undef HAVE_LCMS_LCMS_H
|
|
||||||
|
|
||||||
/* Define if you have the OpenLDAP development environment */
|
/* Define if you have the OpenLDAP development environment */
|
||||||
#undef HAVE_LDAP
|
#undef HAVE_LDAP
|
||||||
|
|
Loading…
Reference in New Issue