summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2013-04-25 09:41:00 +0100
committerRichard Hughes <richard@hughsie.com>2013-04-25 09:41:00 +0100
commit2ef49f445055c50ccfac6ba07fb2d6bc678fa764 (patch)
treed3639c9fe60d4ef61ae39ab834ce3f626d9ff589
parent92b1a129bbec757cd76863567d5e62e78ddd8b58 (diff)
downloadcolord-2ef49f445055c50ccfac6ba07fb2d6bc678fa764.tar.gz
Add a warning for RGB profiles with unlikely whitepoint values
-rw-r--r--lib/colord/cd-enum.c1
-rw-r--r--lib/colord/cd-enum.h2
-rw-r--r--lib/colord/cd-icc.c25
3 files changed, 28 insertions, 0 deletions
diff --git a/lib/colord/cd-enum.c b/lib/colord/cd-enum.c
index 6ca73cd..cc91e8d 100644
--- a/lib/colord/cd-enum.c
+++ b/lib/colord/cd-enum.c
@@ -190,6 +190,7 @@ static const CdEnumMatch enum_profile_warning[] = {
{CD_PROFILE_WARNING_SCUM_DOT, "scum-dot"},
{CD_PROFILE_WARNING_VCGT_NON_MONOTONIC, "vcgt-non-monotonic"},
{CD_PROFILE_WARNING_WHITEPOINT_INVALID, "whitepoint-invalid"},
+ {CD_PROFILE_WARNING_WHITEPOINT_UNLIKELY, "whitepoint-unlikely"},
{0, NULL}
};
diff --git a/lib/colord/cd-enum.h b/lib/colord/cd-enum.h
index d1dda33..1482edc 100644
--- a/lib/colord/cd-enum.h
+++ b/lib/colord/cd-enum.h
@@ -230,6 +230,7 @@ typedef enum {
* @CD_PROFILE_WARNING_PRIMARIES_NON_ADDITIVE: The primaries to not add to give D50 white
* @CD_PROFILE_WARNING_PRIMARIES_UNLIKELY: One or more of the primaries are outside of ROMM RGB
* @CD_PROFILE_WARNING_WHITEPOINT_INVALID: RGB 255,255,255 does not return D50
+ * @CD_PROFILE_WARNING_WHITEPOINT_UNLIKELY: Whitepoint is outside of usual range
*
* The warning about the profile. Profiles with warnings can still be
* used, but may be of limited use.
@@ -247,6 +248,7 @@ typedef enum {
CD_PROFILE_WARNING_PRIMARIES_NON_ADDITIVE, /* Since: 0.1.25 */
CD_PROFILE_WARNING_PRIMARIES_UNLIKELY, /* Since: 0.1.25 */
CD_PROFILE_WARNING_WHITEPOINT_INVALID, /* Since: 0.1.25 */
+ CD_PROFILE_WARNING_WHITEPOINT_UNLIKELY, /* Since: 0.1.34 */
/*< private >*/
CD_PROFILE_WARNING_LAST
} CdProfileWarning;
diff --git a/lib/colord/cd-icc.c b/lib/colord/cd-icc.c
index 0113b09..60400f3 100644
--- a/lib/colord/cd-icc.c
+++ b/lib/colord/cd-icc.c
@@ -2534,6 +2534,26 @@ out:
}
/**
+ * cd_icc_check_whitepoint:
+ **/
+static CdProfileWarning
+cd_icc_check_whitepoint (CdIcc *icc)
+{
+ CdProfileWarning warning = CD_PROFILE_WARNING_NONE;
+ guint temp = icc->priv->temperature;
+
+ /* not set */
+ if (temp == 0)
+ goto out;
+
+ /* hardcoded sanity check */
+ if (temp < 3000 || temp > 10000)
+ warning = CD_PROFILE_WARNING_WHITEPOINT_UNLIKELY;
+out:
+ return warning;
+}
+
+/**
* cd_icc_check_vcgt:
**/
static CdProfileWarning
@@ -2875,6 +2895,11 @@ cd_icc_get_warnings (CdIcc *icc)
if (cmsGetColorSpace (icc->priv->lcms_profile) != cmsSigRgbData)
goto out;
+ /* does profile have an unlikely whitepoint */
+ warning = cd_icc_check_whitepoint (icc);
+ if (warning != CD_PROFILE_WARNING_NONE)
+ g_array_append_val (flags, warning);
+
/* does profile have monotonic VCGT */
warning = cd_icc_check_vcgt (icc->priv->lcms_profile);
if (warning != CD_PROFILE_WARNING_NONE)