mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-04 12:45:45 +01:00
canvas: provide Rect::shrink () with four arguments
This commit is contained in:
parent
2aa313eb4e
commit
b47fbc91e0
1 changed files with 9 additions and 0 deletions
|
|
@ -168,6 +168,15 @@ struct LIBCANVAS_API Rect
|
|||
x1 - amount, y1 - amount);
|
||||
}
|
||||
|
||||
Rect shrink (Distance top, Distance right, Distance bottom, Distance left) const throw () {
|
||||
/* This isn't the equivalent of expand (-distance) because
|
||||
of the peculiarities of canvas_safe_add() with negative values.
|
||||
Maybe.
|
||||
*/
|
||||
return Rect (canvas_safe_add (x0, left), canvas_safe_add (y0, top),
|
||||
x1 - right, y1 - bottom);
|
||||
}
|
||||
|
||||
bool contains (Duple const & point) const throw () {
|
||||
return point.x >= x0 && point.x < x1 && point.y >= y0 && point.y < y1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue