[Rawstudio-commit] r747 - trunk/src

Anders Brander anders at brander.dk
Fri Sep 1 01:31:44 CEST 2006


Author: abrander
Date: 2006-09-01 01:31:44 +0200 (Fri, 01 Sep 2006)
New Revision: 747

Modified:
   trunk/src/color.h
   trunk/src/conf_interface.h
   trunk/src/gtk-interface.c
   trunk/src/rawstudio.c
   trunk/src/rawstudio.h
Log:
Removed all user selectable gamma.

Modified: trunk/src/color.h
===================================================================
--- trunk/src/color.h	2006-08-31 22:40:33 UTC (rev 746)
+++ trunk/src/color.h	2006-08-31 23:31:44 UTC (rev 747)
@@ -23,6 +23,8 @@
 #define GLUM (0.627355)
 #define BLUM (0.075285)
 
+#define GAMMA 2.2 /* this is ONLY used to render the histogram */
+
 #ifdef __i686__
 #define HAVE_CMOV
 #endif

Modified: trunk/src/conf_interface.h
===================================================================
--- trunk/src/conf_interface.h	2006-08-31 22:40:33 UTC (rev 746)
+++ trunk/src/conf_interface.h	2006-08-31 23:31:44 UTC (rev 747)
@@ -20,7 +20,6 @@
 #define CONF_LWD "last_working_directory"
 #define CONF_PREBGCOLOR "preview_background_color"
 #define CONF_HISTHEIGHT "histogram_height"
-#define CONF_GAMMAVALUE "gamma"
 #define CONF_PASTE_MASK "paste_mask"
 #define CONF_DEFAULT_EXPORT_TEMPLATE "default_export_template"
 #define CONF_CACHEDIR_IS_LOCAL "cache_in_home"

Modified: trunk/src/gtk-interface.c
===================================================================
--- trunk/src/gtk-interface.c	2006-08-31 22:40:33 UTC (rev 746)
+++ trunk/src/gtk-interface.c	2006-08-31 23:31:44 UTC (rev 747)
@@ -144,7 +144,7 @@
 	if (rs->photo)
 	{
 		rs_settings_to_rs_settings_double(rs->settings[rs->current_setting], rs->photo->settings[rs->photo->current_setting]);
-		update_previewtable(rs->gamma, rs->photo->settings[rs->photo->current_setting]->contrast);
+		update_previewtable(rs->photo->settings[rs->photo->current_setting]->contrast);
 		update_preview(rs);
 	}
 	return(FALSE);

Modified: trunk/src/rawstudio.c
===================================================================
--- trunk/src/rawstudio.c	2006-08-31 22:40:33 UTC (rev 746)
+++ trunk/src/rawstudio.c	2006-08-31 23:31:44 UTC (rev 747)
@@ -62,7 +62,7 @@
 cmsHTRANSFORM displayTransform;
 cmsHTRANSFORM exportTransform;
 
-inline void rs_photo_prepare(RS_PHOTO *photo, gdouble gamma);
+inline void rs_photo_prepare(RS_PHOTO *photo);
 void update_scaled(RS_BLOB *rs);
 inline void rs_render_mask(guchar *pixels, guchar *mask, guint length);
 gboolean rs_render_idle(RS_BLOB *rs);
@@ -114,14 +114,14 @@
 };
 
 void
-update_previewtable(const gdouble gamma, const gdouble contrast)
+update_previewtable(const gdouble contrast)
 {
 	gint n;
 	gdouble nd;
 	gint res;
 	double gammavalue;
 	const double postadd = 0.5 - (contrast/2.0);
-	gammavalue = (1.0/gamma);
+	gammavalue = (1.0/GAMMA);
 
 	for(n=0;n<65536;n++)
 	{
@@ -132,7 +132,7 @@
 		_CLAMP255(res);
 		previewtable[n] = res;
 
-		nd = pow(nd, gamma);
+		nd = pow(nd, GAMMA);
 		res = (gint) (nd*65535.0);
 		_CLAMP65535(res);
 		previewtable16[n] = res;
@@ -174,7 +174,7 @@
 }
 
 inline void
-rs_photo_prepare(RS_PHOTO *photo, gdouble gamma)
+rs_photo_prepare(RS_PHOTO *photo)
 {
 	matrix4_identity(&photo->mat);
 	matrix4_color_exposure(&photo->mat, photo->settings[photo->current_setting]->exposure);
@@ -197,7 +197,7 @@
 	if(unlikely(!rs->photo)) return;
 
 	update_scaled(rs);
-	rs_photo_prepare(rs->photo, rs->gamma);
+	rs_photo_prepare(rs->photo);
 	update_preview_region(rs, rs->preview_exposed);
 
 	/* Reset histogram_table */
@@ -324,7 +324,7 @@
 				g_string_free(savefile, TRUE);
 
 				rs_cache_load(photo);
-				rs_photo_prepare(photo, 2.2);
+				rs_photo_prepare(photo);
 				rs_photo_save(photo, parsed_filename, queue->filetype, NULL); /* FIXME: profile */
 				g_free(parsed_filename);
 				rs_photo_close(photo);
@@ -968,14 +968,6 @@
 	guint c;
 	rs = g_malloc(sizeof(RS_BLOB));
 	rs->scale = gtk_adjustment_new(0.5, 0.1, 1.0, 0.01, 0.1, 0.0);
-	rs->gamma = 0.0;
-	rs_conf_get_double(CONF_GAMMAVALUE, &rs->gamma);
-	if(rs->gamma < 0.1)
-	{
-		rs->gamma = 2.2;
-		rs_conf_set_double(CONF_GAMMAVALUE,rs->gamma);
-	}
-	update_previewtable(rs->gamma, 1.0);
 	g_signal_connect(G_OBJECT(rs->scale), "value_changed",
 		G_CALLBACK(update_scale_callback), rs);
 	rs->histogram_dataset = NULL;
@@ -1201,7 +1193,7 @@
 		for(n=0;n<256;n++)
 		{
 			nd = ((gdouble) n) / 255.0;
-			res = (gint) (pow(nd, 2.2) * 65535.0);
+			res = (gint) (pow(nd, GAMMA) * 65535.0);
 			_CLAMP65535(res);
 			gammatable[n] = res;
 		}

Modified: trunk/src/rawstudio.h
===================================================================
--- trunk/src/rawstudio.h	2006-08-31 22:40:33 UTC (rev 746)
+++ trunk/src/rawstudio.h	2006-08-31 23:31:44 UTC (rev 747)
@@ -175,7 +175,6 @@
 	RS_SETTINGS *settings[3];
 	gint current_setting;
 	GtkObject *scale;
-	gdouble gamma;
 	gdouble preview_scale;
 	gboolean zoom_to_fit;
 	RS_RECT *preview_exposed;
@@ -217,7 +216,7 @@
 	void (*load_meta)(const gchar *, RS_METADATA *);
 } RS_FILETYPE;
 
-void update_previewtable(const double gamma, const double contrast);
+void update_previewtable(const double contrast);
 void rs_local_cachedir(gboolean new_value);
 void rs_load_gdk(gboolean new_value);
 void update_preview(RS_BLOB *rs);




More information about the Rawstudio-commit mailing list