From ba82e673fd4435065ae9689411d7ed0d232b8cde Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 25 Sep 2016 14:45:39 -0500 Subject: [PATCH] add variant of Rect::expand() that allows different amounts in each direction --- libs/canvas/canvas/types.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/canvas/canvas/types.h b/libs/canvas/canvas/types.h index a92d637925..d0fecf1fda 100644 --- a/libs/canvas/canvas/types.h +++ b/libs/canvas/canvas/types.h @@ -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 -- 2.30.2