[Rawstudio-commit] r2059 - trunk/src

Anders Brander anders at brander.dk
Sat Oct 11 16:57:31 CEST 2008


Author: abrander
Date: 2008-10-11 16:57:30 +0200 (Sat, 11 Oct 2008)
New Revision: 2059

Modified:
   trunk/src/rawstudio.c
   trunk/src/rawstudio.h
   trunk/src/rs-histogram.c
   trunk/src/rs-histogram.h
Log:
Modified RSHistogram to accept a RSSettings.

Modified: trunk/src/rawstudio.c
===================================================================
--- trunk/src/rawstudio.c	2008-10-10 10:49:30 UTC (rev 2058)
+++ trunk/src/rawstudio.c	2008-10-11 14:57:30 UTC (rev 2059)
@@ -158,8 +158,7 @@
 	if (photo == rs->photo)
 	{
 		/* Update histogram */
-		rs_color_transform_set_from_settings(rs->histogram_transform, rs->photo->settings[rs->current_setting], mask);
-		rs_histogram_set_color_transform(RS_HISTOGRAM_WIDGET(rs->histogram), rs->histogram_transform);
+		rs_histogram_set_settings(RS_HISTOGRAM_WIDGET(rs->histogram), rs->photo->settings[rs->current_setting]);
 
 		/* Update histogram in curve */
 		rs_curve_draw_histogram(RS_CURVE_WIDGET(rs->curve[rs->current_setting]),
@@ -351,7 +350,6 @@
 	guint c;
 	rs = g_malloc(sizeof(RS_BLOB));
 	rs->histogram_dataset = NULL;
-	rs->histogram_transform = rs_color_transform_new();
 	rs->settings_buffer = NULL;
 	rs->photo = NULL;
 	rs->queue = rs_batch_new_queue();

Modified: trunk/src/rawstudio.h
===================================================================
--- trunk/src/rawstudio.h	2008-10-10 10:49:30 UTC (rev 2058)
+++ trunk/src/rawstudio.h	2008-10-11 14:57:30 UTC (rev 2059)
@@ -109,7 +109,6 @@
 	gint current_setting;
 	RS_IMAGE16 *histogram_dataset;
 	GtkWidget *histogram;
-	RSColorTransform *histogram_transform;
 	RS_QUEUE *queue;
 	RS_CMS *cms;
 	RSStore *store;

Modified: trunk/src/rs-histogram.c
===================================================================
--- trunk/src/rs-histogram.c	2008-10-10 10:49:30 UTC (rev 2058)
+++ trunk/src/rs-histogram.c	2008-10-11 14:57:30 UTC (rev 2059)
@@ -21,7 +21,10 @@
 #include "rs-histogram.h"
 #include "rs-color-transform.h"
 #include "rs-math.h"
+#include "rs-color-transform.h"
 
+/* FIXME: Do some cleanup in finalize! */
+
 struct _RSHistogramWidget
 {
 	GtkDrawingArea parent;
@@ -29,6 +32,7 @@
 	gint height;
 	GdkPixmap *blitter;
 	RS_IMAGE16 *image;
+	RSSettings *settings;
 	RSColorTransform *rct;
 	guint input_samples[4][256];
 	guint *output_samples[4];
@@ -69,7 +73,8 @@
 	hist->output_samples[2] = NULL;
 	hist->output_samples[3] = NULL;
 	hist->image = NULL;
-	hist->rct = NULL;
+	hist->settings = NULL;
+	hist->rct = rs_color_transform_new();
 	hist->blitter = NULL;
 
 	g_signal_connect(G_OBJECT(hist), "size-allocate", G_CALLBACK(size_allocate), NULL);
@@ -135,18 +140,23 @@
 }
 
 /**
- * Set color transform to be used when rendering histogram
+ * Set a RSSettings to use
  * @param histogram A RSHistogramWidget
- * @param rct A RSColorTransform
+ * @param settings A RSSettings object to use
  */
 void
-rs_histogram_set_color_transform(RSHistogramWidget *histogram, RSColorTransform *rct)
+rs_histogram_set_settings(RSHistogramWidget *histogram, RSSettings *settings)
 {
 	g_return_if_fail (RS_IS_HISTOGRAM_WIDGET(histogram));
-	g_return_if_fail (rct);
+	g_return_if_fail (RS_IS_SETTINGS(settings));
 
-	histogram->rct = rct;
+	if (histogram->settings)
+		g_object_unref(histogram->settings);
 
+	histogram->settings = g_object_ref(settings);
+
+	rs_color_transform_set_from_settings(histogram->rct, histogram->settings, MASK_ALL);
+
 	rs_histogram_redraw(histogram);
 }
 

Modified: trunk/src/rs-histogram.h
===================================================================
--- trunk/src/rs-histogram.h	2008-10-10 10:49:30 UTC (rev 2058)
+++ trunk/src/rs-histogram.h	2008-10-11 14:57:30 UTC (rev 2059)
@@ -22,11 +22,11 @@
 extern void rs_histogram_set_image(RSHistogramWidget *histogram, RS_IMAGE16 *image);
 
 /**
- * Set color transform to be used when rendering histogram
+ * Set a RSSettings to use
  * @param histogram A RSHistogramWidget
- * @param rct A RSColorTransform
+ * @param settings A RSSettings object to use
  */
-extern void rs_histogram_set_color_transform(RSHistogramWidget *histogram, RSColorTransform *rct);
+extern void rs_histogram_set_settings(RSHistogramWidget *histogram, RSSettings *settings);
 
 /**
  * Redraw a RSHistogramWidget




More information about the Rawstudio-commit mailing list