[Rawstudio-commit] r1971 - trunk/src

Anders Brander anders at brander.dk
Mon Sep 1 19:35:08 CEST 2008


Author: abrander
Date: 2008-09-01 19:35:08 +0200 (Mon, 01 Sep 2008)
New Revision: 1971

Modified:
   trunk/src/gtk-helper.c
   trunk/src/rs-cms.c
   trunk/src/rs-cms.h
Log:
Do direction check in rs_cms_is_profile_valid().

Modified: trunk/src/gtk-helper.c
===================================================================
--- trunk/src/gtk-helper.c	2008-08-31 18:34:32 UTC (rev 1970)
+++ trunk/src/gtk-helper.c	2008-09-01 17:35:08 UTC (rev 1971)
@@ -430,7 +430,7 @@
 }
 
 static gchar *
-gui_cms_choose_profile(const gchar *path)
+gui_cms_choose_profile(const gchar *path, const CMS_PROFILE profile)
 {
 	gchar *ret = NULL;
 	GtkWidget *fc;
@@ -478,7 +478,7 @@
 		gchar *filename;
 		filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (fc));
 
-		if (rs_cms_is_profile_valid(filename))
+		if (rs_cms_is_profile_valid(filename, profile))
 			ret = filename;
 		else
 		{
@@ -505,7 +505,7 @@
 	GtkWidget *combobox = GTK_WIDGET(user_data);
 	gchar *filename;
 
-	filename = gui_cms_choose_profile(NULL);
+	filename = gui_cms_choose_profile(NULL, PROFILE_INPUT);
 
 	if (filename)
 	{
@@ -524,7 +524,7 @@
 	GtkWidget *combobox = GTK_WIDGET(user_data);
 	gchar *filename; 
 
-	filename = gui_cms_choose_profile(NULL);
+	filename = gui_cms_choose_profile(NULL, PROFILE_DISPLAY);
 
 	if (filename)
 	{
@@ -543,7 +543,7 @@
 	GtkWidget *combobox = GTK_WIDGET(user_data);
 	gchar *filename;
 
-	filename = gui_cms_choose_profile(NULL);
+	filename = gui_cms_choose_profile(NULL, PROFILE_EXPORT);
 
 	if (filename)
 	{

Modified: trunk/src/rs-cms.c
===================================================================
--- trunk/src/rs-cms.c	2008-08-31 18:34:32 UTC (rev 1970)
+++ trunk/src/rs-cms.c	2008-09-01 17:35:08 UTC (rev 1971)
@@ -57,20 +57,26 @@
 }
 
 gboolean
-rs_cms_is_profile_valid(const gchar *path)
+rs_cms_is_profile_valid(const gchar *path, const CMS_PROFILE profile)
 {
 	gboolean ret = FALSE;
-	cmsHPROFILE profile;
+	cmsHPROFILE lcms_profile;
 
 	if (path)
 	{
 		CMS_LOCK();
-		profile = cmsOpenProfileFromFile(path, "r");
-		if (profile)
+		lcms_profile = cmsOpenProfileFromFile(path, "r");
+		if (lcms_profile)
 		{
-			if (cmsGetColorSpace(profile) == 0x52474220) /* we only support RGB-profiles */
-				ret = TRUE;
-			cmsCloseProfile(profile);
+			if (cmsGetColorSpace(lcms_profile) == 0x52474220) /* we only support RGB-profiles */
+			{
+				/* Perceptual is the fall-back method of LittleCMS */
+				if (profile == PROFILE_INPUT)
+					ret = cmsIsIntentSupported(lcms_profile, INTENT_PERCEPTUAL, LCMS_USED_AS_INPUT);
+				else
+					ret = cmsIsIntentSupported(lcms_profile, INTENT_PERCEPTUAL, LCMS_USED_AS_OUTPUT);
+			}
+			cmsCloseProfile(lcms_profile);
 		}
 		CMS_UNLOCK();
 	}
@@ -200,7 +206,6 @@
 
 	if (cms->enabled)
 	{
-		/* FIXME: Propagate fails from cmsIsIntentSupported() to the user somehow! */
 		if (cms->profiles[PROFILE_INPUT] && cmsIsIntentSupported(cms->profiles[PROFILE_INPUT], cms->intent, LCMS_USED_AS_INPUT))
 			in = cms->profiles[PROFILE_INPUT];
 		else

Modified: trunk/src/rs-cms.h
===================================================================
--- trunk/src/rs-cms.h	2008-08-31 18:34:32 UTC (rev 1970)
+++ trunk/src/rs-cms.h	2008-09-01 17:35:08 UTC (rev 1971)
@@ -38,7 +38,7 @@
 typedef struct _RS_CMS RS_CMS;
 
 extern void rs_cms_enable(RS_CMS *cms, gboolean enable);
-extern gboolean rs_cms_is_profile_valid(const gchar *path);
+extern gboolean rs_cms_is_profile_valid(const gchar *path, const CMS_PROFILE profile);
 extern void rs_cms_set_profile(RS_CMS *cms, CMS_PROFILE profile, const gchar *filename);
 extern gchar *rs_cms_get_profile_filename(RS_CMS *cms, CMS_PROFILE profile);
 extern void rs_cms_set_intent(RS_CMS *cms, gint intent);




More information about the Rawstudio-commit mailing list