+ bool paint_thr_bg =
+ conversion_threshold_disp_mode_ == GlobalSettings::ConvThrDispMode_Background;
+
+ const vector<double> thresholds = base_->get_conversion_thresholds();
+
+ // Only display thresholds if we have some and we show analog samples
+ if ((thresholds.size() > 0) && paint_thr_bg &&
+ ((display_type_ == DisplayAnalog) || (display_type_ == DisplayBoth))) {
+
+ const int visual_y = get_visual_y();
+ const pair<int, int> extents = v_extents();
+ const int top = visual_y + extents.first;
+ const int btm = visual_y + extents.second;
+
+ // Draw high/neutral/low areas
+ if (thresholds.size() == 2) {
+ int thr_lo = visual_y - thresholds[0] * scale_;
+ int thr_hi = visual_y - thresholds[1] * scale_;
+ thr_lo = min(max(thr_lo, top), btm);
+ thr_hi = min(max(thr_hi, top), btm);
+
+ p.fillRect(QRectF(pp.left(), top, pp.width(), thr_hi - top),
+ QBrush(ThresholdColorHi));
+ p.fillRect(QRectF(pp.left(), thr_hi, pp.width(), thr_lo - thr_hi),
+ QBrush(ThresholdColorNe));
+ p.fillRect(QRectF(pp.left(), thr_lo, pp.width(), btm - thr_lo),
+ QBrush(ThresholdColorLo));
+ } else {
+ int thr = visual_y - thresholds[0] * scale_;
+ thr = min(max(thr, top), btm);
+
+ p.fillRect(QRectF(pp.left(), top, pp.width(), thr - top),
+ QBrush(ThresholdColorHi));
+ p.fillRect(QRectF(pp.left(), thr, pp.width(), btm - thr),
+ QBrush(ThresholdColorLo));
+ }