mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
Only call Gtk::Widget::queue_draw_area in canvas when item and visible area intersect
Refactor GtkCanvas::request_redraw to use Rect::intersection
This commit is contained in:
parent
c4e31fc322
commit
8538ba35fe
1 changed files with 10 additions and 10 deletions
|
|
@ -1197,19 +1197,19 @@ GtkCanvas::request_redraw (Rect const & request)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect real_area;
|
|
||||||
|
|
||||||
Coord const w = width ();
|
|
||||||
Coord const h = height ();
|
|
||||||
|
|
||||||
/* clamp area requested to actual visible window */
|
/* clamp area requested to actual visible window */
|
||||||
|
|
||||||
real_area.x0 = max (0.0, min (w, request.x0));
|
Rect real_area = request.intersection (visible_area());
|
||||||
real_area.x1 = max (0.0, min (w, request.x1));
|
|
||||||
real_area.y0 = max (0.0, min (h, request.y0));
|
|
||||||
real_area.y1 = max (0.0, min (h, request.y1));
|
|
||||||
|
|
||||||
queue_draw_area (real_area.x0, real_area.y0, real_area.width(), real_area.height());
|
if (real_area) {
|
||||||
|
if (real_area.width () && real_area.height ()) {
|
||||||
|
// Item intersects with visible canvas area
|
||||||
|
queue_draw_area (real_area.x0, real_area.y0, real_area.width(), real_area.height());
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Item does not intersect with visible canvas area
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Called to request that we try to get a particular size for ourselves.
|
/** Called to request that we try to get a particular size for ourselves.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue