add variant of Rect::expand() that allows different amounts in each direction
authorPaul Davis <paul@linuxaudiosystems.com>
Sun, 25 Sep 2016 19:45:39 +0000 (14:45 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 27 Sep 2016 19:59:32 +0000 (14:59 -0500)
libs/canvas/canvas/types.h

index a92d637925a93365e981714d574d5a7b98f71385..d0fecf1fda0279bd412caff4af543d4de0e036ab 100644 (file)
@@ -31,7 +31,7 @@
 #include "canvas/visibility.h"
 
 namespace Cairo {
 #include "canvas/visibility.h"
 
 namespace Cairo {
-       class Context;
+       class Context;
 }
 
 namespace ArdourCanvas
 }
 
 namespace ArdourCanvas
@@ -141,6 +141,11 @@ struct LIBCANVAS_API Rect
                             canvas_safe_add (x1, amount),
                             canvas_safe_add (y1, amount));
        }
                             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
 
        Rect shrink (Distance amount) const throw () {
                /* This isn't the equivalent of expand (-distance) because