From: Joel Holdsworth Date: Tue, 18 Nov 2014 21:27:41 +0000 (+0000) Subject: DecodeTrace: Tidied up get_sample_range X-Git-Tag: pulseview-0.3.0~493 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=db1bf6bf5a76726631b521b1c6b3968d14d66b30;p=pulseview.git DecodeTrace: Tidied up get_sample_range --- diff --git a/pv/view/decodetrace.cpp b/pv/view/decodetrace.cpp index be962176..fb4b7c29 100644 --- a/pv/view/decodetrace.cpp +++ b/pv/view/decodetrace.cpp @@ -532,18 +532,16 @@ double DecodeTrace::get_samples_per_pixel() const return samplerate * scale; } -pair DecodeTrace::get_sample_range(int x_start, int x_end) const +pair DecodeTrace::get_sample_range( + int x_start, int x_end) const { - assert(_view); - assert(_decoder_stack); - const double samples_per_pixel = get_samples_per_pixel(); const double pixels_offset = get_pixels_offset(); - uint64_t start, end; - - start = (uint64_t)max((x_start + pixels_offset) * samples_per_pixel, 0.0); - end = (uint64_t)max((x_end + pixels_offset) * samples_per_pixel, 0.0); + const uint64_t start = (uint64_t)max( + (x_start + pixels_offset) * samples_per_pixel, 0.0); + const uint64_t end = (uint64_t)max( + (x_end + pixels_offset) * samples_per_pixel, 0.0); return make_pair(start, end); }