diff --git a/histogram.cc b/histogram.cc index bebfde2..2378ed8 100644 --- a/histogram.cc +++ b/histogram.cc @@ -25,6 +25,7 @@ int histogram_pressed_x; // window x-coordinate when pressing a b int histogram_released_x; // window x-coordinate when releasing a button int histogram_pressed = 0; // indicates button pressed or not int histogram_zoomed = 0; // indicates zoom +int histogram_log = 1; // logarithmic or linear scale extern GtkBuilder *_builder_; // work around for threads @@ -72,7 +73,10 @@ void cb_histogramda_draw(GtkWidget *area, cairo_t *cr, int w, int h, gpointer da int histogram_scale = histogram_width - 1 > 0 ? histogram_width - 1 : 1; for (int i = 0; i < histogram_width; i++) { px = HISTOGRAM_MARGIN + ((clientw-HISTOGRAM_MARGIN*2) * i) / histogram_scale; - py2 = (clienth-HISTOGRAM_MARGIN) - ((clienth-HISTOGRAM_MARGIN*2) * log10(histogram[chan][histogram_zoom_start+i]+1) / log10(histogram_max)); + if (histogram_log) + py2 = (clienth-HISTOGRAM_MARGIN) - ((clienth-HISTOGRAM_MARGIN*2) * log10(histogram[chan][histogram_zoom_start+i]+1) / log10(histogram_max)); + else + py2 = (clienth-HISTOGRAM_MARGIN) - ((clienth-HISTOGRAM_MARGIN*2) * histogram[chan][histogram_zoom_start+i] / histogram_max); if (i == 0) cairo_move_to(cr, px, py2); else cairo_line_to(cr, px, py2);