add variant of Rect::expand() that allows different amounts in each direction

This commit is contained in:
Paul Davis 2016-09-25 14:45:39 -05:00
parent 5d43d2e43f
commit ba82e673fd

View File

@ -31,7 +31,7 @@
#include "canvas/visibility.h"
namespace Cairo {
class Context;
class Context;
}
namespace ArdourCanvas
@ -141,6 +141,11 @@ struct LIBCANVAS_API Rect
canvas_safe_add (x1, amount),
canvas_safe_add (y1, amount));
}
Rect expand (Distance top, Distance right, Distance bottom, Distance left) const throw () {
return Rect (x0 - left, y0 - top,
canvas_safe_add (x1, right),
canvas_safe_add (y1, bottom));
}
Rect shrink (Distance amount) const throw () {
/* This isn't the equivalent of expand (-distance) because