[gnome-color-manager] trivial: remove any dark offset from the computed RGB values
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] trivial: remove any dark offset from the computed RGB values
- Date: Mon, 28 Nov 2011 21:35:49 +0000 (UTC)
commit 61e34539de0573648683e21afba883c93bdfe6a7
Author: Richard Hughes <richard hughsie com>
Date: Mon Nov 28 21:20:58 2011 +0000
trivial: remove any dark offset from the computed RGB values
src/gcm-calibrate.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-calibrate.c b/src/gcm-calibrate.c
index fec952e..884a6a9 100644
--- a/src/gcm-calibrate.c
+++ b/src/gcm-calibrate.c
@@ -1083,6 +1083,46 @@ out:
}
/**
+ * gcm_calibrate_array_remove_offset:
+ **/
+static void
+gcm_calibrate_array_remove_offset (GPtrArray *array)
+{
+ CdColorRGB offset;
+ CdColorRGB *rgb;
+ guint i;
+
+ /* remove the backlight leakage */
+ cd_color_set_rgb (&offset,
+ G_MAXDOUBLE,
+ G_MAXDOUBLE,
+ G_MAXDOUBLE);
+ for (i = 0; i < array->len; i++) {
+ rgb = g_ptr_array_index (array, i);
+ if (rgb->R < offset.R)
+ offset.R = rgb->R;
+ if (rgb->G < offset.G)
+ offset.G = rgb->G;
+ if (rgb->B < offset.B)
+ offset.B = rgb->B;
+ }
+ for (i = 0; i < array->len; i++) {
+ rgb = g_ptr_array_index (array, i);
+ rgb->R -= offset.R;
+ rgb->G -= offset.G;
+ rgb->B -= offset.B;
+ if (rgb->R < 0.0f)
+ rgb->R = 0.0f;
+ if (rgb->G < 0.0f)
+ rgb->G = 0.0f;
+ if (rgb->B < 0.0f)
+ rgb->B = 0.0f;
+ }
+ g_debug ("removed offset = %f,%f,%f",
+ offset.R, offset.G, offset.B);
+}
+
+/**
* gcm_calibrate_display_calibration:
**/
gboolean
@@ -1163,6 +1203,9 @@ gcm_calibrate_display_calibration (GcmCalibrate *calibrate,
if (!ret)
goto out;
+ /* bias the values to zero */
+ gcm_calibrate_array_remove_offset (results_rgb);
+
out:
if (samples_rgb != NULL)
g_ptr_array_unref (samples_rgb);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]