summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2013-07-22 11:14:02 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@kit.edu>2013-07-22 11:14:02 +0200
commit381ea8e4b4c15ef916a692160b50c3491699fe98 (patch)
treecd0f32b025812e09f8184480c8363c532900facd /bin
parent032ee20f23304e1c67db97f3651052447c2e9bfd (diff)
downloadlibuca-381ea8e4b4c15ef916a692160b50c3491699fe98.tar.gz
libuca-381ea8e4b4c15ef916a692160b50c3491699fe98.tar.bz2
libuca-381ea8e4b4c15ef916a692160b50c3491699fe98.tar.xz
libuca-381ea8e4b4c15ef916a692160b50c3491699fe98.zip
Update histogram when moving frame slider
Diffstat (limited to 'bin')
-rw-r--r--bin/common/ring-buffer.c8
-rw-r--r--bin/common/ring-buffer.h2
-rw-r--r--bin/gui/control.c8
3 files changed, 15 insertions, 3 deletions
diff --git a/bin/common/ring-buffer.c b/bin/common/ring-buffer.c
index 039024f..850dfc0 100644
--- a/bin/common/ring-buffer.c
+++ b/bin/common/ring-buffer.c
@@ -44,6 +44,14 @@ ring_buffer_get_current_pointer (RingBuffer *buffer)
return buffer->data + (buffer->current_index % buffer->n_blocks_total) * buffer->block_size;
}
+void
+ring_buffer_set_current_pointer (RingBuffer *buffer,
+ guint index)
+{
+ g_assert (index < buffer->n_blocks_total);
+ buffer->current_index = index;
+}
+
gpointer
ring_buffer_get_pointer (RingBuffer *buffer,
guint index)
diff --git a/bin/common/ring-buffer.h b/bin/common/ring-buffer.h
index a3758cb..fafe5ec 100644
--- a/bin/common/ring-buffer.h
+++ b/bin/common/ring-buffer.h
@@ -19,6 +19,8 @@ void ring_buffer_free (RingBuffer *buffer);
void ring_buffer_reset (RingBuffer *buffer);
gsize ring_buffer_get_block_size (RingBuffer *buffer);
gpointer ring_buffer_get_current_pointer (RingBuffer *buffer);
+void ring_buffer_set_current_pointer (RingBuffer *buffer,
+ guint index);
gpointer ring_buffer_get_pointer (RingBuffer *buffer,
guint index);
guint ring_buffer_get_num_blocks (RingBuffer *buffer);
diff --git a/bin/gui/control.c b/bin/gui/control.c
index 74b8312..6327366 100644
--- a/bin/gui/control.c
+++ b/bin/gui/control.c
@@ -397,10 +397,12 @@ static void
update_current_frame (ThreadData *data)
{
gpointer buffer;
- gint index;
+ guint index;
- index = (gint) gtk_adjustment_get_value (data->frame_slider);
- buffer = ring_buffer_get_pointer (data->buffer, index);
+ index = (guint) gtk_adjustment_get_value (data->frame_slider);
+ ring_buffer_set_current_pointer (data->buffer, index);
+
+ buffer = ring_buffer_get_current_pointer (data->buffer);
convert_grayscale_to_rgb (data, buffer);
update_pixbuf (data);
}