From d086d55b44e3b72c151b3aa1f247a107fd62b566 Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 4 Jul 2013 13:26:42 +0100 Subject: [PATCH] Added division operator to Rectangle. --- modules/juce_graphics/geometry/juce_Rectangle.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/juce_graphics/geometry/juce_Rectangle.h b/modules/juce_graphics/geometry/juce_Rectangle.h index 68768a0576..4fcd8793bd 100644 --- a/modules/juce_graphics/geometry/juce_Rectangle.h +++ b/modules/juce_graphics/geometry/juce_Rectangle.h @@ -310,6 +310,20 @@ public: return *this; } + /** Scales this rectangle by the given amount, centred around the origin. */ + template + Rectangle operator/ (FloatType scaleFactor) const noexcept + { + return operator* (((FloatType) 1) / scaleFactor); + } + + /** Scales this rectangle by the given amount, centred around the origin. */ + template + Rectangle operator/= (FloatType scaleFactor) noexcept + { + return operator*= (((FloatType) 1) / scaleFactor); + } + /** Expands the rectangle by a given amount. Effectively, its new size is (x - deltaX, y - deltaY, w + deltaX * 2, h + deltaY * 2).