From: Soeren Apel Date: Sun, 21 Oct 2018 11:07:41 +0000 (+0200) Subject: Fix for "fill logic signal high areas" feature X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=bae42c1d8a6fbe65e412d56edecdd4b354908339 Fix for "fill logic signal high areas" feature At certain zoom levels, the algorithm wrongly fills areas where the signal is low. This patch fixes this. --- diff --git a/pv/views/trace/analogsignal.cpp b/pv/views/trace/analogsignal.cpp index 5b3241d2..2643c643 100644 --- a/pv/views/trace/analogsignal.cpp +++ b/pv/views/trace/analogsignal.cpp @@ -614,10 +614,11 @@ void AnalogSignal::paint_logic_mid(QPainter &p, ViewItemPaintParams &pp) if (fill_high_areas) { // Any edge terminates a high area - const int width = x - rising_edge_x; - if (rising_edge_seen && (width > 0)) { - high_rects.emplace_back(rising_edge_x, high_offset, - width, signal_height); + if (rising_edge_seen) { + const int width = x - rising_edge_x; + if (width > 0) + high_rects.emplace_back(rising_edge_x, high_offset, + width, signal_height); rising_edge_seen = false; } diff --git a/pv/views/trace/logicsignal.cpp b/pv/views/trace/logicsignal.cpp index f43ac37e..a5d0a598 100644 --- a/pv/views/trace/logicsignal.cpp +++ b/pv/views/trace/logicsignal.cpp @@ -258,10 +258,11 @@ void LogicSignal::paint_mid(QPainter &p, ViewItemPaintParams &pp) if (fill_high_areas) { // Any edge terminates a high area - const int width = x - rising_edge_x; - if (rising_edge_seen && (width > 0)) { - high_rects.emplace_back(rising_edge_x, high_offset, - width, signal_height_); + if (rising_edge_seen) { + const int width = x - rising_edge_x; + if (width > 0) + high_rects.emplace_back(rising_edge_x, high_offset, + width, signal_height_); rising_edge_seen = false; }