From 652010ea57ca43952d626f33ebf84fb01a663ed4 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 7 Jul 2012 08:16:07 +0100 Subject: [PATCH] Fixed signal ends to cover screen --- logicdatasnapshot.cpp | 6 +++--- logicsignal.cpp | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/logicdatasnapshot.cpp b/logicdatasnapshot.cpp index 032d9c8..e29a866 100644 --- a/logicdatasnapshot.cpp +++ b/logicdatasnapshot.cpp @@ -65,7 +65,7 @@ void LogicDataSnapshot::get_subsampled_edges( bool last_sample = get_sample(start) & sig_mask; edges.push_back(pair(start, last_sample)); - for(int64_t i = start + 1; i < end - 1; i++) + for(int64_t i = start + 1; i < end; i++) { const bool sample = get_sample(i) & sig_mask; @@ -89,6 +89,6 @@ void LogicDataSnapshot::get_subsampled_edges( } // Add the final state - edges.push_back(pair(end - 1, - get_sample(end - 1) & sig_mask)); + edges.push_back(pair(end, + get_sample(end) & sig_mask)); } diff --git a/logicsignal.cpp b/logicsignal.cpp index 486c002..79a27dd 100644 --- a/logicsignal.cpp +++ b/logicsignal.cpp @@ -86,16 +86,16 @@ void LogicSignal::paint(QGLWidget &widget, const QRect &rect, const double pixels_offset = offset / scale; const double samplerate = _data->get_samplerate(); const double start_time = _data->get_start_time(); - const int64_t last_sample = (int64_t)snapshot->get_sample_count() - 1; + const int64_t last_sample = snapshot->get_sample_count() - 1; const double samples_per_pixel = samplerate * scale; - const int64_t start = min(max((int64_t)(samplerate * (offset - start_time)), - (int64_t)0), last_sample); - const int64_t end = min((int64_t)(start + samples_per_pixel * rect.width()), - last_sample); + const double start = samplerate * (offset - start_time); + const double end = start + samples_per_pixel * rect.width(); const int64_t quantization_length = 1LL << (int64_t)floorf( - max(logf(samples_per_pixel / Log2), 0.0f)); + max(logf((float)samples_per_pixel) / Log2, 0.0f)); - snapshot->get_subsampled_edges(edges, start, end, + snapshot->get_subsampled_edges(edges, + min(max((int64_t)floor(start), (int64_t)0), last_sample), + min(max((int64_t)ceil(end), (int64_t)0), last_sample), quantization_length, _probe_index); // Paint the edges -- 2.30.2