Fix for "fill logic signal high areas" feature
authorSoeren Apel <soeren@apelpie.net>
Sun, 21 Oct 2018 11:07:41 +0000 (13:07 +0200)
committerSoeren Apel <soeren@apelpie.net>
Sun, 21 Oct 2018 15:12:03 +0000 (17:12 +0200)
At certain zoom levels, the algorithm wrongly fills areas where
the signal is low. This patch fixes this.

pv/views/trace/analogsignal.cpp
pv/views/trace/logicsignal.cpp

index 5b3241d..2643c64 100644 (file)
@@ -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;
                        }
 
index f43ac37..a5d0a59 100644 (file)
@@ -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;
                        }