summaryrefslogtreecommitdiffstats
path: root/third_party/qcms
diff options
context:
space:
mode:
authornoel <noel@chromium.org>2016-01-09 13:40:08 -0800
committerCommit bot <commit-bot@chromium.org>2016-01-09 21:41:27 +0000
commit9e32f9faa97cc7c97e9d62eebc2a5b64bb134883 (patch)
tree5c2aefeca4fa7362f1ea245cada7d52d9f866403 /third_party/qcms
parent951c006477244de91b595a250636847c1373c2a1 (diff)
downloadchromium_src-9e32f9faa97cc7c97e9d62eebc2a5b64bb134883.zip
chromium_src-9e32f9faa97cc7c97e9d62eebc2a5b64bb134883.tar.gz
chromium_src-9e32f9faa97cc7c97e9d62eebc2a5b64bb134883.tar.bz2
[qcms] Set the media white point of the sRGB profile
Set the media (or source) white point in the profile struct when creating the internal sRGB color profile. Per spec, the source white point of sRGB is D65, and that is the value stored (the callers of these helpers pass in D65). BUG=565222 Review URL: https://codereview.chromium.org/1563873004 Cr-Commit-Position: refs/heads/master@{#368526}
Diffstat (limited to 'third_party/qcms')
-rw-r--r--third_party/qcms/README.chromium2
-rw-r--r--third_party/qcms/src/iccread.c4
-rw-r--r--third_party/qcms/src/transform.c19
3 files changed, 18 insertions, 7 deletions
diff --git a/third_party/qcms/README.chromium b/third_party/qcms/README.chromium
index e7211bd..6e299b4 100644
--- a/third_party/qcms/README.chromium
+++ b/third_party/qcms/README.chromium
@@ -129,6 +129,8 @@ The following changes have been made since qcms was imported:
- http://code.google.com/p/chromium/issues/detail?id=565222
- Add a qcms_profile_get_white_point() api
- http://code.google.com/p/chromium/issues/detail?id=565222
+ - Set the media white point of the sRGB profile
+ - http://code.google.com/p/chromium/issues/detail?id=565222
For the Chromium changes, since the import, in a patch format run:
git diff b8456f38 src
diff --git a/third_party/qcms/src/iccread.c b/third_party/qcms/src/iccread.c
index 61b5312..1b6aaf6 100644
--- a/third_party/qcms/src/iccread.c
+++ b/third_party/qcms/src/iccread.c
@@ -1182,7 +1182,6 @@ qcms_profile* qcms_profile_create_rgb_with_gamma(
if (!profile)
return NO_MEM_PROFILE;
- //XXX: should store the whitepoint
if (!set_rgb_colorants(profile, white_point, primaries)) {
qcms_profile_release(profile);
return INVALID_PROFILE;
@@ -1196,6 +1195,7 @@ qcms_profile* qcms_profile_create_rgb_with_gamma(
qcms_profile_release(profile);
return NO_MEM_PROFILE;
}
+
profile->class = DISPLAY_DEVICE_PROFILE;
profile->rendering_intent = QCMS_INTENT_PERCEPTUAL;
profile->color_space = RGB_SIGNATURE;
@@ -1212,7 +1212,6 @@ qcms_profile* qcms_profile_create_rgb_with_table(
if (!profile)
return NO_MEM_PROFILE;
- //XXX: should store the whitepoint
if (!set_rgb_colorants(profile, white_point, primaries)) {
qcms_profile_release(profile);
return INVALID_PROFILE;
@@ -1226,6 +1225,7 @@ qcms_profile* qcms_profile_create_rgb_with_table(
qcms_profile_release(profile);
return NO_MEM_PROFILE;
}
+
profile->class = DISPLAY_DEVICE_PROFILE;
profile->rendering_intent = QCMS_INTENT_PERCEPTUAL;
profile->color_space = RGB_SIGNATURE;
diff --git a/third_party/qcms/src/transform.c b/third_party/qcms/src/transform.c
index f2c2f8e..27a8ad5 100644
--- a/third_party/qcms/src/transform.c
+++ b/third_party/qcms/src/transform.c
@@ -200,23 +200,26 @@ adaption_matrix(struct CIE_XYZ source_illumination, struct CIE_XYZ target_illumi
}
/* from lcms: cmsAdaptMatrixToD50 */
-static struct matrix adapt_matrix_to_D50(struct matrix r, qcms_CIE_xyY source_white_pt)
+static struct matrix adapt_matrix_to_D50(struct matrix r, qcms_CIE_xyY source_white_point)
{
- struct CIE_XYZ Dn;
+ struct CIE_XYZ DNN_XYZ;
struct matrix Bradford;
- if (source_white_pt.y == 0.0)
+ if (source_white_point.y == 0.0)
return matrix_invalid();
- Dn = xyY2XYZ(source_white_pt);
+ DNN_XYZ = xyY2XYZ(source_white_point);
+
+ Bradford = adaption_matrix(DNN_XYZ, D50_XYZ);
- Bradford = adaption_matrix(Dn, D50_XYZ);
return matrix_multiply(Bradford, r);
}
qcms_bool set_rgb_colorants(qcms_profile *profile, qcms_CIE_xyY white_point, qcms_CIE_xyYTRIPLE primaries)
{
+ struct CIE_XYZ source_white;
struct matrix colorants;
+
colorants = build_RGB_to_XYZ_transfer_matrix(white_point, primaries);
colorants = adapt_matrix_to_D50(colorants, white_point);
@@ -236,6 +239,12 @@ qcms_bool set_rgb_colorants(qcms_profile *profile, qcms_CIE_xyY white_point, qcm
profile->blueColorant.Y = double_to_s15Fixed16Number(colorants.m[1][2]);
profile->blueColorant.Z = double_to_s15Fixed16Number(colorants.m[2][2]);
+ /* Store the media white point */
+ source_white = xyY2XYZ(white_point);
+ profile->mediaWhitePoint.X = double_to_s15Fixed16Number(source_white.X);
+ profile->mediaWhitePoint.Y = double_to_s15Fixed16Number(source_white.Y);
+ profile->mediaWhitePoint.Z = double_to_s15Fixed16Number(source_white.Z);
+
return true;
}