From: Soeren Apel Date: Sat, 21 Apr 2018 21:28:12 +0000 (+0200) Subject: Fix bar displaying undecoded area X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e06cf18db72c518d11f90e9f96dfc3aeed85314f;p=pulseview.git Fix bar displaying undecoded area 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. --- diff --git a/pv/data/decodesignal.cpp b/pv/data/decodesignal.cpp index 8483d91d..4739b606 100644 --- a/pv/data/decodesignal.cpp +++ b/pv/data/decodesignal.cpp @@ -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 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 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(); diff --git a/pv/views/trace/decodetrace.cpp b/pv/views/trace/decodetrace.cpp index f4f24393..da160e4b 100644 --- a/pv/views/trace/decodetrace.cpp +++ b/pv/views/trace/decodetrace.cpp @@ -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);