mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
Canvas::queue_draw_item_area() now expands the passed-in rect appropriately
This means that a request to (re)draw the Rect (0.5,0.5,9.5,9.5) will actually generate an expose event for (0,0,10,10) Note: the above rects are of the form (x0,y0,x1,y1)
This commit is contained in:
parent
fa2fdc6f19
commit
9c071cd6ef
1 changed files with 35 additions and 1 deletions
|
|
@ -414,7 +414,41 @@ Canvas::item_moved (Item* item, Rect pre_change_parent_bounding_box)
|
|||
void
|
||||
Canvas::queue_draw_item_area (Item* item, Rect area)
|
||||
{
|
||||
request_redraw (item->item_to_window (area));
|
||||
if ((area.width()) > 1.0 && (area.height() > 1.0)) {
|
||||
/* item has a rectangular bounding box, which may fall
|
||||
* on non-integer locations. Expand it appropriately.
|
||||
*/
|
||||
Rect r = item->item_to_window (area, false);
|
||||
r.x0 = floor (r.x0);
|
||||
r.y0 = floor (r.y0);
|
||||
r.x1 = ceil (r.x1);
|
||||
r.y1 = ceil (r.y1);
|
||||
//std::cerr << "redraw box, adjust from " << area << " to " << r << std::endl;
|
||||
request_redraw (r);
|
||||
return;
|
||||
} else if (area.width() > 1.0 && area.height() == 1.0) {
|
||||
/* horizontal line, which may fall on non-integer
|
||||
* coordinates.
|
||||
*/
|
||||
Rect r = item->item_to_window (area, false);
|
||||
r.y0 = floor (r.y0);
|
||||
r.y1 = ceil (r.y1);
|
||||
//std::cerr << "redraw HLine, adjust from " << area << " to " << r << std::endl;
|
||||
request_redraw (r);
|
||||
} else if (area.width() == 1.0 && area.height() > 1.0) {
|
||||
/* vertical single pixel line, which may fall on non-integer
|
||||
* coordinates
|
||||
*/
|
||||
Rect r = item->item_to_window (area, false);
|
||||
r.x0 = floor (r.x0);
|
||||
r.x1 = ceil (r.x1);
|
||||
//std::cerr << "redraw VLine, adjust from " << area << " to " << r << std::endl;
|
||||
request_redraw (r);
|
||||
} else {
|
||||
/* impossible? one of width or height must be zero ... */
|
||||
//std::cerr << "redraw IMPOSSIBLE of " << area << std::endl;
|
||||
request_redraw (item->item_to_window (area, false));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue