diff options
-rw-r--r-- | ggamma.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -33,6 +33,14 @@ void curve_edited(GtkWidget *raw_curve, UNUSED GdkEvent *event, struct gamma_cha gamma->flush(); } +void curve_set(GtkGammaCurve *curve, struct gamma_channel *gamma) { + gfloat vec[gamma->size]; + for (int i = 0; i < gamma->size; i++) + vec[i] = gamma->data[i] * gamma->size / 65535.0; + gtk_curve_set_vector(GTK_CURVE(curve->curve), + gamma->size, vec); +} + GtkWidget *curve_new(struct gamma_channel *gamma) { GtkWidget *curve = gtk_gamma_curve_new(); GtkWidget *raw_curve = GTK_GAMMA_CURVE(curve)->curve; @@ -42,16 +50,11 @@ GtkWidget *curve_new(struct gamma_channel *gamma) { * So there's no point in making it awkwardly tall to get the * extra precision; just make it a square, we're not really * loosing anything. */ - gtk_curve_set_range(GTK_CURVE(raw_curve), /* x */0, gamma->size-1, /* y */0, gamma->size-1); - gfloat vec[gamma->size]; - for (int i = 0; i < gamma->size; i++) - vec[i] = gamma->data[i] * gamma->size / 65535.0; - gtk_curve_set_vector(GTK_CURVE(raw_curve), - gamma->size, vec); + curve_set(GTK_GAMMA_CURVE(curve), gamma); // TODO: find a better signal g_signal_connect(raw_curve, "event-after", G_CALLBACK(curve_edited), gamma); |