[gnome-color-manager] Add a performance increase when the gamma, contrast and brightness are all default values



commit 5afc0cba203d14e5e2bd6c505bfb2bc25c945b5c
Author: Richard Hughes <richard hughsie com>
Date:   Tue Nov 3 13:22:02 2009 +0000

    Add a performance increase when the gamma, contrast and brightness are all default values

 src/gcm-clut.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-clut.c b/src/gcm-clut.c
index fd3de3d..aec402d 100644
--- a/src/gcm-clut.c
+++ b/src/gcm-clut.c
@@ -304,6 +304,10 @@ static guint
 gcm_clut_get_adjusted_value (guint value, gfloat min, gfloat max, gfloat gamma)
 {
 	guint retval;
+
+	/* optimise for the common case */
+	if (min < 0.01f && max > 0.99f && gamma > 0.99 && gamma < 1.01)
+		return value;
 	retval = 65536.0f * ((powf (((gfloat)value/65536.0f), gamma) * (max - min)) + min);
 	return retval;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]