r15143 by fschmid - Enabled LCMS-2 + fixes for Linux.

scribus-commit scribus-commit at lists.scribus.net
Sun May 30 20:10:35 CEST 2010


Revision: 15143
Author: fschmid
Date: 2010-05-30T18:04:42.050557Z
Commit message: Enabled LCMS-2 + fixes for Linux.

Changeset: 
M  /trunk/Scribus/scribus/colormgmt/sclcms2colorprofileimpl.cpp
M  /trunk/Scribus/cmake/modules/FindLCMS2.cmake
M  /trunk/Scribus/config.h.cmake
M  /trunk/Scribus/scribus/colormgmt/CMakeLists.txt
M  /trunk/Scribus/CMakeLists.txt
M  /trunk/Scribus/scribus/colormgmt/sclcms2colormgmtengineimpl.cpp

Diffs:
Index: cmake/modules/FindLCMS2.cmake
===================================================================
--- cmake/modules/FindLCMS2.cmake	(revision 15142)
+++ cmake/modules/FindLCMS2.cmake	(revision 15143)
@@ -43,7 +43,7 @@
 
 IF (LCMS2_LIBRARY AND LCMS2_INCLUDE_DIR)
   SET( LCMS2_FOUND 1 )
-  SET( LCMS2_LIBRARIES ${LCMS2_LIBRARY} )
+  SET( LCMS_LIBRARIES ${LCMS2_LIBRARY} )
 ELSE (LCMS2_LIBRARY AND LCMS2_INCLUDE_DIR)
   SET( LCMS2_FOUND 0 )
 ENDIF (LCMS2_LIBRARY AND LCMS2_INCLUDE_DIR)
Index: scribus/colormgmt/sclcms2colormgmtengineimpl.cpp
===================================================================
--- scribus/colormgmt/sclcms2colormgmtengineimpl.cpp	(revision 15142)
+++ scribus/colormgmt/sclcms2colormgmtengineimpl.cpp	(revision 15143)
@@ -7,6 +7,7 @@
 
 #include <iostream>
 #include <string>
+#include <cstdlib>
 #include <QDir>
 #include <QFile>
 
@@ -83,6 +84,7 @@
 			hIn = cmsOpenProfileFromFile(profilePath.data(), "r");
 			if (hIn == NULL)
 				continue;
+#ifdef _WIN32
 			cmsUInt32Number descSize = cmsGetProfileInfo(hIn, cmsInfoDescription, "en", "US", NULL, 0);
 			if (descSize > 0)
 			{
@@ -100,6 +102,19 @@
 					free(descData);
 				}
 			}
+#else
+			cmsUInt32Number descSize = cmsGetProfileInfoASCII(hIn, cmsInfoDescription, "en", "US", NULL, 0);
+			if (descSize > 0)
+			{
+				char* descData = (char*) malloc(descSize + sizeof(char));
+				descSize = cmsGetProfileInfoASCII(hIn, cmsInfoDescription, "en", "US", descData, descSize);
+				if (descSize > 0)
+				{
+					profileInfo.description = QString(descData);
+					free(descData);
+				}
+			}
+#endif
 			if (profileInfo.description.isEmpty())
 			{
 				cmsCloseProfile(hIn);
Index: scribus/colormgmt/sclcms2colorprofileimpl.cpp
===================================================================
--- scribus/colormgmt/sclcms2colorprofileimpl.cpp	(revision 15142)
+++ scribus/colormgmt/sclcms2colorprofileimpl.cpp	(revision 15143)
@@ -7,6 +7,7 @@
 
 #include "sclcms2colorprofileimpl.h"
 #include "sclcms2colormgmtengineimpl.h"
+#include <cstdlib>
 
 ScLcms2ColorProfileImpl::ScLcms2ColorProfileImpl(ScColorMgmtEngine& engine, cmsHPROFILE lcmsProfile)
                       : ScColorProfileImplBase(engine), m_profileHandle(lcmsProfile)
@@ -44,6 +45,7 @@
 	{
 		if (m_profileHandle)
 		{
+#ifdef _WIN32
 			cmsUInt32Number descSize = cmsGetProfileInfo(m_profileHandle, cmsInfoDescription, "en", "US", NULL, 0);
 			if (descSize > 0)
 			{
@@ -61,6 +63,19 @@
 					free(descData);
 				}
 			}
+#else
+			cmsUInt32Number descSize = cmsGetProfileInfoASCII(m_profileHandle, cmsInfoDescription, "en", "US", NULL, 0);
+			if (descSize > 0)
+			{
+				char* descData = (char*) malloc(descSize + sizeof(char));
+				descSize = cmsGetProfileInfoASCII(m_profileHandle, cmsInfoDescription, "en", "US", descData, descSize);
+				if (descSize > 0)
+				{
+					m_productDescription = QString(descData);
+					free(descData);
+				}
+			}
+#endif
 		}
 	}
 	return m_productDescription;
Index: scribus/colormgmt/CMakeLists.txt
===================================================================
--- scribus/colormgmt/CMakeLists.txt	(revision 15142)
+++ scribus/colormgmt/CMakeLists.txt	(revision 15143)
@@ -31,9 +31,6 @@
 	sccolorspacedata.cpp
 	sccolortransform.cpp
 	sccolortransformpool.cpp
-	sclcmscolormgmtengineimpl.cpp
-	sclcmscolorprofileimpl.cpp
-	sclcmscolortransformimpl.cpp
 	${SCRIBUS_LCMS_IMPL_SOURCES}
 )
 
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 15142)
+++ CMakeLists.txt	(revision 15143)
@@ -647,14 +647,22 @@
 
 #<<LittleCMS
 SET(LCMS_DIR ${CMAKE_MODULE_PATH})
-FIND_PACKAGE(LCMS REQUIRED)
-IF(LCMS_FOUND)
+FIND_PACKAGE(LCMS2)
+IF(LCMS2_FOUND)
+  SET(HAVE_LCMS2 1)
   SET(HAVE_CMS 1)
-  SET(CMS_INC "lcms.h")
-  MESSAGE("LittleCMS Library Found OK")
-ELSE(LCMS_FOUND)
-  MESSAGE(FATAL_ERROR "Could not find the LittleCMS Library")
-ENDIF(LCMS_FOUND)
+  SET(CMS_INC "\"lcms2.h\"")
+  MESSAGE("LittleCMS-2 Library Found OK")
+ELSE(LCMS2_FOUND)
+  FIND_PACKAGE(LCMS REQUIRED)
+  IF(LCMS_FOUND)
+    SET(HAVE_CMS 1)
+    SET(CMS_INC "\"lcms.h\"")
+    MESSAGE("LittleCMS Library Found OK")
+  ELSE(LCMS_FOUND)
+    MESSAGE(FATAL_ERROR "Could not find the LittleCMS Library")
+  ENDIF(LCMS_FOUND)
+ENDIF(LCMS2_FOUND)
 #>>LittleCMS
 
 #<<FontConfig
Index: config.h.cmake
===================================================================
--- config.h.cmake	(revision 15142)
+++ config.h.cmake	(revision 15143)
@@ -17,8 +17,9 @@
 #cmakedefine DLL_USE_NATIVE_API 1
 #cmakedefine BUILD_MAC_BUNDLE
 #cmakedefine HAVE_CMS 1
+#cmakedefine HAVE_LCMS2 1
+#cmakedefine CMS_INC @CMS_INC@
 #cmakedefine HAVE_XML 1
-#cmakedefine CMS_INC "lcms.h"
 #cmakedefine HAVE_CAIRO 1
 #cmakedefine HAVE_PRIVATE_CAIRO 1
 #cmakedefine HAVE_CUPS 1




More information about the scribus-commit mailing list