]> sigrok.org Git - pulseview.git/commitdiff
DecodeTrace: Tidied up get_sample_range
authorJoel Holdsworth <redacted>
Tue, 18 Nov 2014 21:27:41 +0000 (21:27 +0000)
committerJoel Holdsworth <redacted>
Wed, 19 Nov 2014 10:22:41 +0000 (10:22 +0000)
pv/view/decodetrace.cpp

index be962176cb9f679427bcf92c406e8c6643103357..fb4b7c29844fa5be0cc35b23fd45db6f50d8ea45 100644 (file)
@@ -532,18 +532,16 @@ double DecodeTrace::get_samples_per_pixel() const
        return samplerate * scale;
 }
 
-pair<uint64_t, uint64_t> DecodeTrace::get_sample_range(int x_start, int x_end) const
+pair<uint64_t, uint64_t> 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);
 }