+
+ float mpp;
+
+ if (_show_minmax) {
+ mpp = -1000000.0;
+
+ cairo_set_source_rgba(cr, res->get_color().get_red_p(), res->get_color().get_green_p(), res->get_color().get_blue_p(), 0.30);
+ cairo_move_to(cr, 0.5f + (float)_logScale[0], 0.5f + (float)( fft_pane_size_h - (int)floor( (res->maxAt(0) - min) * pixels_per_db) ));
+
+ // Draw the line of maximum values
+ for (int x = 1; x < res->length(); x++) {
+ if (res->maxAt(x) > mpp)
+ mpp = res->maxAt(x);
+ mpp = fmax(mpp, min);
+ mpp = fmin(mpp, max);
+
+ // If the next point on the log scale is at the same location,
+ // don't draw yet
+ if (x + 1 < res->length() && _logScale[x] == _logScale[x + 1]) {
+ continue;
+ }
+
+ float X = 0.5f + (float)_logScale[x];
+ float Y = 0.5f + (float)( fft_pane_size_h - (int)floor( (mpp - min) * pixels_per_db) );
+
+ cairo_line_to(cr, X, Y);
+
+ mpp = -1000000.0;
+ }
+
+ mpp = +10000000.0;
+ // Draw back to the start using the minimum value
+ for (int x = res->length()-1; x >= 0; x--) {
+ if (res->minAt(x) < mpp)
+ mpp = res->minAt(x);
+ mpp = fmax(mpp, min);
+ mpp = fmin(mpp, max);
+
+ // If the next point on the log scale is at the same location,
+ // don't draw yet
+ if (x - 1 > 0 && _logScale[x] == _logScale[x - 1]) {
+ continue;
+ }
+
+ float X = 0.5f + (float)_logScale[x];
+ float Y = 0.5f + (float)( fft_pane_size_h - (int)floor( (mpp - min) * pixels_per_db) );
+
+ cairo_line_to(cr, X, Y );
+
+ mpp = +10000000.0;
+ }
+
+ cairo_close_path(cr);
+
+ cairo_fill(cr);
+ }
+
+