[gthumb] fixed histogram computation and visualization



commit 854b96e37b11a3a640396b2996bcb7005ec9a590
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed May 18 21:20:13 2011 +0200

    fixed histogram computation and visualization

 gthumb/gth-histogram-view.c |    4 ++--
 gthumb/gth-histogram.c      |   14 +++++++-------
 2 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/gthumb/gth-histogram-view.c b/gthumb/gth-histogram-view.c
index d0aaae8..ce76c07 100644
--- a/gthumb/gth-histogram-view.c
+++ b/gthumb/gth-histogram-view.c
@@ -281,7 +281,7 @@ _gth_histogram_view_update_info (GthHistogramView *self)
 
 	if (gth_histogram_view_get_display_mode (self) == GTH_HISTOGRAM_MODE_ALL_CHANNELS) {
 		max = MAX (gth_histogram_get_channel_max (self->priv->histogram, 1), gth_histogram_get_channel_max (self->priv->histogram, 2));
-		max = MAX (max, gth_histogram_get_channel_max (self->priv->histogram, 2));
+		max = MAX (max, gth_histogram_get_channel_max (self->priv->histogram, 3));
 	}
 	else
 		max = gth_histogram_get_channel_max (self->priv->histogram, first_channel);
@@ -393,7 +393,7 @@ gth_histogram_paint_rgb (GthHistogramView *self,
 
 	style = gtk_widget_get_style (GTK_WIDGET (self));
 	max = MAX (gth_histogram_get_channel_max (self->priv->histogram, 1), gth_histogram_get_channel_max (self->priv->histogram, 2));
-	max = MAX (max, gth_histogram_get_channel_max (self->priv->histogram, 2));
+	max = MAX (max, gth_histogram_get_channel_max (self->priv->histogram, 3));
 	if (max > 0.0)
 		max = convert_to_scale (self->priv->scale_type, max);
 	else
diff --git a/gthumb/gth-histogram.c b/gthumb/gth-histogram.c
index 220a483..488c0bd 100644
--- a/gthumb/gth-histogram.c
+++ b/gthumb/gth-histogram.c
@@ -189,15 +189,15 @@ gth_histogram_calculate_for_pixbuf (GthHistogram    *self,
 
 		for (j = 0; j < width; j++) {
 			/* count values for each RGB channel */
-			values[1][pixel[0]] += 1;
-			values[2][pixel[1]] += 1;
-			values[3][pixel[2]] += 1;
+			values[1][pixel[CAIRO_RED]] += 1;
+			values[2][pixel[CAIRO_GREEN]] += 1;
+			values[3][pixel[CAIRO_BLUE]] += 1;
 			if (n_channels > 3)
-				values[4][ pixel[3] ] += 1;
+				values[4][ pixel[CAIRO_ALPHA] ] += 1;
 
 			/* count value for Value channel */
-			max = MAX (pixel[0], pixel[1]);
-			max = MAX (pixel[2], max);
+			max = MAX (pixel[CAIRO_RED], pixel[CAIRO_GREEN]);
+			max = MAX (pixel[CAIRO_BLUE], max);
 			values[0][max] += 1;
 
 			/* track max value for each channel */
@@ -206,7 +206,7 @@ gth_histogram_calculate_for_pixbuf (GthHistogram    *self,
 			values_max[2] = MAX (values_max[2], values[2][pixel[1]]);
 			values_max[3] = MAX (values_max[3], values[3][pixel[2]]);
 			if (n_channels > 3)
-				values_max[4] = MAX (values_max[4], values[4][pixel[3]]);
+				values_max[4] = MAX (values_max[4], values[4][pixel[CAIRO_ALPHA]]);
 
 			pixel += n_channels;
 		}



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