aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-06-12 17:26:00 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-06-12 17:29:46 +0200
commit68141b1fb33a1bf8497248e3d341d62487df2092 (patch)
treecf55e537f503759603fed4f8e441d1759c9ae2df
parent95d42f9a3236a3415a4d30aa823520123e21ea0d (diff)
downloadexperiment-player-68141b1fb33a1bf8497248e3d341d62487df2092.tar.gz
resolve numeric instability when calculating contribution pixel positions
the pixel distance between contributions must be independant of the current time to avoid flickering in the text rendering when time progresses
-rw-r--r--lib/gtk-experiment-widgets/gtk-experiment-transcript.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/gtk-experiment-widgets/gtk-experiment-transcript.c b/lib/gtk-experiment-widgets/gtk-experiment-transcript.c
index b33d230..d722d94 100644
--- a/lib/gtk-experiment-widgets/gtk-experiment-transcript.c
+++ b/lib/gtk-experiment-widgets/gtk-experiment-transcript.c
@@ -406,7 +406,7 @@ gtk_experiment_transcript_text_layer_redraw(GtkExperimentTranscript *trans)
{
GtkWidget *widget = GTK_WIDGET(trans);
- gint64 current_time = 0;
+ gint64 current_time = 0, current_time_px;
gint last_contrib_y = -1;
gdk_draw_rectangle(GDK_DRAWABLE(trans->priv->layer_text),
@@ -427,6 +427,7 @@ gtk_experiment_transcript_text_layer_redraw(GtkExperimentTranscript *trans)
if (trans->priv->time_adjustment != NULL)
current_time = (gint64)gtk_adjustment_get_value(GTK_ADJUSTMENT(trans->priv->time_adjustment));
+ current_time_px = TIME_TO_PX(current_time);
for (GList *cur = experiment_reader_get_contribution_by_time(
trans->priv->contribs,
@@ -437,7 +438,7 @@ gtk_experiment_transcript_text_layer_redraw(GtkExperimentTranscript *trans)
cur->data;
gint y = widget->allocation.height -
- TIME_TO_PX(current_time - contrib->start_time);
+ (current_time_px - TIME_TO_PX(contrib->start_time));
int logical_height;
PangoAttrList *attrib_list;