13
0

Fix calculating intersection of waveform rectangle

see also 68eb63e0c8
This commit is contained in:
Robin Gareus 2024-09-27 02:54:35 +02:00
parent 9945d7721f
commit d8e4e7b259
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -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; 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 = 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 */ /* Now lets get the intersection with the area we've been asked to draw */
draw_rect = item_rect.intersection (canvas_rect); 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 // No intersection with drawing area
return false; 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 /* draw_rect now defines the rectangle we need to update/render the waveview
* into, in window coordinate space. * into, in window coordinate space.
* *