[PATCH] mscms: Use lcms2, when available
Detlef Riekenberg
wine.dev at web.de
Tue May 7 15:45:39 CDT 2013
lcms2 was released on 8. May 2010 and should be present in important
distributions since a while.
lcms v1 is on the way to be phased out in the newest distribution
versions.
Possible Implementations:
1: Use lcms2 when available with a fallback to lcms v1 (static linking)
2: Replace lcms v1 with lcms2 without fallback (static linking)
3: Use runtime linking, try lcms2 with a fallback to lcms v1
I used version 1 for this patch.
An additional option is removing support for lcms v1 after the stable release.
Differences between lcmsv2 and lcms v1
-- cmsCreateLabProfile no longer present in lcms2
There is a new cmsCreateLab2Profile function, but i have
no idea about these functions.
- For Wine, i added a FIXME (TYPE_Lab_16 output format)
-- cmsSetErrorHandler no longer present in lcms2
There is a new plugin-API in lcms2, but i did not ckeck
for a replacement. Does Wine really need the error handler?
- For Wine, i remove the error handler
-- lcms2 supports 24bit profiles, while lcms v1 did not
I have no app to test mscms.
Please comment.
--
By by ... Detlef
---
configure.ac | 22 +++++++++++++++-------
dlls/mscms/mscms_main.c | 4 ++--
dlls/mscms/mscms_priv.h | 12 ++++++++++++
dlls/mscms/transform.c | 8 +++++++-
4 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index 98c3dd4..d56373e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1445,15 +1445,23 @@ dnl **** Check for LittleCMS ***
if test "x$with_lcms" != "xno"
then
ac_save_CPPFLAGS="$CPPFLAGS"
- WINE_PACKAGE_FLAGS(LCMS,[lcms],[-llcms])
- AC_CHECK_HEADERS([lcms.h lcms/lcms.h])
- if test "$ac_cv_header_lcms_h" = "yes" -o "$ac_cv_header_lcms_lcms_h" = "yes"
+ WINE_PACKAGE_FLAGS(LCMS,[lcms2],[-llcms2])
+ AC_CHECK_HEADERS([lcms2.h])
+ if test "$ac_cv_header_lcms2_h" = "yes"
then
- AC_CHECK_LIB(lcms, cmsOpenProfileFromFile,
- [AC_DEFINE(HAVE_LCMS, 1, [Define if you have the LittleCMS development environment])],[LCMS_LIBS=""])
+ AC_CHECK_LIB(lcms2, cmsOpenProfileFromFile,
+ [AC_DEFINE(HAVE_LCMS2, 1, [Define if you have the LittleCMS v2 development environment])],[LCMS_LIBS=""])
else
- LCMS_CFLAGS=""
- LCMS_LIBS=""
+ WINE_PACKAGE_FLAGS(LCMS,[lcms],[-llcms])
+ AC_CHECK_HEADERS([lcms.h lcms/lcms.h])
+ if test "$ac_cv_header_lcms_h" = "yes" -o "$ac_cv_header_lcms_lcms_h" = "yes"
+ then
+ AC_CHECK_LIB(lcms, cmsOpenProfileFromFile,
+ [AC_DEFINE(HAVE_LCMS1, 1, [Define if you have the LittleCMS v1 development environment])],[LCMS_LIBS=""])
+ else
+ LCMS_CFLAGS=""
+ LCMS_LIBS=""
+ fi
fi
CPPFLAGS="$ac_save_CPPFLAGS"
fi
diff --git a/dlls/mscms/mscms_main.c b/dlls/mscms/mscms_main.c
index 3199c0b..a4c4ee9 100644
--- a/dlls/mscms/mscms_main.c
+++ b/dlls/mscms/mscms_main.c
@@ -36,7 +36,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(mscms);
-#ifdef HAVE_LCMS
+#ifdef HAVE_LCMS1
static int lcms_error_handler( int error, const char *text )
{
switch (error)
@@ -61,7 +61,7 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
{
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls( hinst );
-#ifdef HAVE_LCMS
+#ifdef HAVE_LCMS1
cmsSetErrorHandler( lcms_error_handler );
#endif
break;
diff --git a/dlls/mscms/mscms_priv.h b/dlls/mscms/mscms_priv.h
index ffaf13b..34ee5f1 100644
--- a/dlls/mscms/mscms_priv.h
+++ b/dlls/mscms/mscms_priv.h
@@ -18,6 +18,14 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#ifdef HAVE_LCMS2
+#define HAVE_LCMS 2
+#else
+#ifdef HAVE_LCMS1
+#define HAVE_LCMS 1
+#endif
+#endif
+
#ifdef HAVE_LCMS
/* These basic Windows types are defined in lcms.h when compiling on
@@ -47,11 +55,15 @@
#undef HIWORD
#undef MAX_PATH
+#ifdef HAVE_LCMS2_H
+#include <lcms2.h>
+#else
#ifdef HAVE_LCMS_LCMS_H
#include <lcms/lcms.h>
#else
#include <lcms.h>
#endif
+#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
diff --git a/dlls/mscms/transform.c b/dlls/mscms/transform.c
index 363400c..fb9a558 100644
--- a/dlls/mscms/transform.c
+++ b/dlls/mscms/transform.c
@@ -237,7 +237,13 @@ HTRANSFORM WINAPI CreateMultiProfileTransform( PHPROFILE profiles, DWORD nprofil
{
/* insert a conversion profile for pairings that lcms doesn't handle */
if (out_format == TYPE_RGB_16) cmsconvert = cmsCreate_sRGBProfile();
- if (out_format == TYPE_Lab_16) cmsconvert = cmsCreateLabProfile( NULL );
+ if (out_format == TYPE_Lab_16)
+#ifdef HAVE_LCMS1
+ cmsconvert = cmsCreateLabProfile( NULL );
+#else
+ FIXME("TYPE_Lab_16 not implemented with lcms v2\n");
+#endif
+
}
cmsprofiles = HeapAlloc( GetProcessHeap(), 0, (nprofiles + 1) * sizeof(cmsHPROFILE) );
--
1.7.5.4
More information about the wine-patches
mailing list