[gnome-color-manager] Do not try to stuff negative numbers into a guint32 value to avoid random spikes on the TRC graph
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Do not try to stuff negative numbers into a guint32 value to avoid random spikes on the TRC graph
- Date: Fri, 8 Apr 2011 10:54:07 +0000 (UTC)
commit 565e14ff2a924f8e0f2040b5d6667f9cd0e0083e
Author: Richard Hughes <richard hughsie com>
Date: Thu Apr 7 17:13:04 2011 +0100
Do not try to stuff negative numbers into a guint32 value to avoid random spikes on the TRC graph
src/gcm-profile.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/src/gcm-profile.c b/src/gcm-profile.c
index 664e156..71c07d5 100644
--- a/src/gcm-profile.c
+++ b/src/gcm-profile.c
@@ -1399,6 +1399,7 @@ gcm_profile_generate_curve (GcmProfile *profile, guint size)
cmsHTRANSFORM transform = NULL;
guint type;
CdColorspace colorspace;
+ gdouble tmp;
GcmProfilePrivate *priv = profile->priv;
/* run through the profile */
@@ -1452,9 +1453,21 @@ gcm_profile_generate_curve (GcmProfile *profile, guint size)
for (i=0; i<size; i++) {
data = g_new0 (GcmClutData, 1);
- data->red = values_out[(i * 3 * component_width)+0] * (gfloat) 0xffff;
- data->green = values_out[(i * 3 * component_width)+4] * (gfloat) 0xffff;
- data->blue = values_out[(i * 3 * component_width)+8] * (gfloat) 0xffff;
+ /* default values */
+ data->red = 0;
+ data->green = 0;
+ data->blue = 0;
+
+ /* only save curve data if it is positive */
+ tmp = values_out[(i * 3 * component_width)+0] * (gfloat) 0xffff;
+ if (tmp > 0.0f)
+ data->red = tmp;
+ tmp = values_out[(i * 3 * component_width)+4] * (gfloat) 0xffff;
+ if (tmp > 0.0f)
+ data->green = tmp;
+ tmp = values_out[(i * 3 * component_width)+8] * (gfloat) 0xffff;
+ if (tmp > 0.0f)
+ data->blue = tmp;
g_ptr_array_add (array, data);
}
clut = gcm_clut_new ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]