/*
* Geeqie
- * Copyright (C) 2008 - 2009 The Geeqie Team
+ * Copyright (C) 2008 - 2012 The Geeqie Team
*
* Author: Vladimir Nadvornik
* based on a patch by Uwe Ohse
gulong b[HISTMAP_SIZE];
gulong max[HISTMAP_SIZE];
- gint idle_id;
+ guint idle_id; /* event source id */
GdkPixbuf *pixbuf;
gint y;
};
Histogram *histogram;
histogram = g_new0(Histogram, 1);
- histogram->histogram_channel = HCHAN_RGB;
+ histogram->histogram_channel = HCHAN_DEFAULT;
histogram->histogram_mode = 0;
/* grid */
static HistMap *histmap_new(void)
{
HistMap *histmap = g_new0(HistMap, 1);
- histmap->idle_id = -1;
return histmap;
}
void histmap_free(HistMap *histmap)
{
if (!histmap) return;
- if (histmap->idle_id != -1) g_source_remove(histmap->idle_id);
+ if (histmap->idle_id) g_source_remove(histmap->idle_id);
if (histmap->pixbuf) g_object_unref(histmap->pixbuf);
g_free(histmap);
}
}
}
histmap->y = end_line;
- return end_line >= h;
+ return end_line >= h;
}
const HistMap *histmap_get(FileData *fd)
{
- if (fd->histmap && fd->histmap->idle_id == -1) return fd->histmap; /* histmap exists and is finished */
+ if (fd->histmap && !fd->histmap->idle_id) return fd->histmap; /* histmap exists and is finished */
return NULL;
}
/* finished */
g_object_unref(fd->histmap->pixbuf); /*pixbuf is no longer needed */
fd->histmap->pixbuf = NULL;
- fd->histmap->idle_id = -1;
+ fd->histmap->idle_id = 0;
file_data_send_notification(fd, NOTIFY_HISTMAP);
return FALSE;
}
for (j = 0; j < num_chan; j++)
{
gint chanmax;
- if (histogram->histogram_channel == HCHAN_RGB)
+ if (histogram->histogram_channel == HCHAN_RGB)
{
chanmax = HCHAN_R;
if (v[HCHAN_G] > v[HCHAN_R]) chanmax = HCHAN_G;
void histogram_notify_cb(FileData *fd, NotifyType type, gpointer data)
{
- if ((type & (NOTIFY_CHANGE | NOTIFY_REREAD)) && fd->histmap)
+ if ((type & NOTIFY_REREAD) && fd->histmap)
{
DEBUG_1("Notify histogram: %s %04x", fd->path, type);
histmap_free(fd->histmap);