]> sigrok.org Git - pulseview.git/commitdiff
Fix bar displaying undecoded area
authorSoeren Apel <redacted>
Sat, 21 Apr 2018 21:28:12 +0000 (23:28 +0200)
committerSoeren Apel <redacted>
Tue, 24 Apr 2018 21:15:05 +0000 (23:15 +0200)
Issue #1: As decoding happens while the trace is drawn, the
annotations may actually overlap with the bar because the number
of decoded samples is outdated.

Issue #2: The bar is a little too low and off-center.

pv/data/decodesignal.cpp
pv/views/trace/decodetrace.cpp

index 8483d91d0ce4a2b41de67a07605d2a757d761137..4739b60675ab3e97ee9496ebc1a1d642ccf12bca 100644 (file)
@@ -902,6 +902,13 @@ void DecodeSignal::decode_data(
                const int64_t chunk_end = min(i + chunk_sample_count,
                        abs_start_samplenum + sample_count);
 
+               // Report this chunk as already decoded so that annotations don't
+               // appear in an area that we claim to not having been been decoded yet
+               {
+                       lock_guard<mutex> lock(output_mutex_);
+                       segments_.at(current_segment_id_).samples_decoded = chunk_end;
+               }
+
                int64_t data_size = (chunk_end - i) * unit_size;
                uint8_t* chunk = new uint8_t[data_size];
                input_segment->get_samples(i, chunk_end, chunk);
@@ -915,11 +922,6 @@ void DecodeSignal::decode_data(
 
                delete[] chunk;
 
-               {
-                       lock_guard<mutex> lock(output_mutex_);
-                       segments_.at(current_segment_id_).samples_decoded = chunk_end;
-               }
-
                // Notify the frontend that we processed some data and
                // possibly have new annotations as well
                new_annotations();
index f4f243931bd6d27e94952afba35421a38d1ebf2e..da160e4b1ab9c3af7083286ff4529f06603ddd11 100644 (file)
@@ -581,7 +581,7 @@ void DecodeTrace::draw_unresolved_period(QPainter &p, int h, int left, int right
                samples_per_pixel - pixels_offset, left - 1.0);
        const double end = min(sample_count / samples_per_pixel -
                pixels_offset, right + 1.0);
-       const QRectF no_decode_rect(start, y - (h / 2) + 0.5, end - start, h);
+       const QRectF no_decode_rect(start, y - (h / 2) - 0.5, end - start, h);
 
        p.setPen(QPen(Qt::NoPen));
        p.setBrush(Qt::white);