diff src/image-overlay.c @ 1294:7ac9664242b2

histogram caching histogram interface prepared for histogram pane
author nadvornik
date Sun, 15 Feb 2009 13:11:21 +0000
parents 10073464e6aa
children 9b59d40030d2
line wrap: on
line diff
--- a/src/image-overlay.c	Sun Feb 15 09:36:53 2009 +0000
+++ b/src/image-overlay.c	Sun Feb 15 13:11:21 2009 +0000
@@ -442,6 +442,7 @@
 	gchar *text;
 	GdkPixbuf *imgpixbuf = NULL;
 	gboolean with_hist;
+	HistMap *histmap;
 	ImageWindow *imd = osd->imd;
 	FileData *fd = image_get_fd(imd);
 
@@ -553,7 +554,13 @@
 		text = g_markup_escape_text(_("Untitled"), -1);
 	}
 
-	with_hist = (imgpixbuf && (osd->show & OSD_SHOW_HISTOGRAM) && osd->histogram && (!imd->il || image_loader_get_is_done(imd->il)));
+	with_hist = ((osd->show & OSD_SHOW_HISTOGRAM) && osd->histogram);
+	if (with_hist)
+		{
+		histmap = histmap_get(imd->image_fd);
+		if (!histmap) with_hist = FALSE;
+		}
+	
 	
 	{
 		gint active_marks = 0;
@@ -611,7 +618,6 @@
 
 	if (with_hist)
 		{
-		histogram_read(osd->histogram, imgpixbuf);
 		if (width < HISTOGRAM_WIDTH + 10) width = HISTOGRAM_WIDTH + 10;
 		height += HISTOGRAM_HEIGHT + 5;
 		}
@@ -649,7 +655,7 @@
 				xoffset += add+d;
 				}
 						
-			histogram_draw(osd->histogram, pixbuf, x, y, w, HISTOGRAM_HEIGHT);
+			histogram_draw(osd->histogram, histmap, pixbuf, x, y, w, HISTOGRAM_HEIGHT);
 			}
 		pixbuf_draw_layout(pixbuf, layout, imd->pr, 5, 5, 0, 0, 0, 255);
 	}