From d8e4e7b259a33e46db5a750c76c691f2d0e7c931 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 27 Sep 2024 02:54:35 +0200 Subject: [PATCH] Fix calculating intersection of waveform rectangle see also 68eb63e0c8b --- libs/waveview/wave_view.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libs/waveview/wave_view.cc b/libs/waveview/wave_view.cc index 79365b1432..af619a8de5 100644 --- a/libs/waveview/wave_view.cc +++ b/libs/waveview/wave_view.cc @@ -309,6 +309,11 @@ WaveView::get_item_and_draw_rect_in_window_coords (Rect const& canvas_rect, Rect double const width = region_length() / _props->samples_per_pixel; item_rect = item_to_window (Rect (0.0, 0.0, width, _props->height), false); + item_rect.x0 = floor (item_rect.x0); + item_rect.x1 = ceil (item_rect.x1); + item_rect.y0 = round (item_rect.y0); + item_rect.y1 = round (item_rect.y1); + /* Now lets get the intersection with the area we've been asked to draw */ draw_rect = item_rect.intersection (canvas_rect); @@ -317,12 +322,6 @@ WaveView::get_item_and_draw_rect_in_window_coords (Rect const& canvas_rect, Rect // No intersection with drawing area return false; } - - item_rect.x0 = floor (item_rect.x0); - item_rect.x1 = ceil (item_rect.x1); - item_rect.y0 = round (item_rect.y0); - item_rect.y1 = round (item_rect.y1); - /* draw_rect now defines the rectangle we need to update/render the waveview * into, in window coordinate space. *