From f1f237ebbfa52b63d0b0fbf2fc619c7b945ca041 Mon Sep 17 00:00:00 2001 From: jules Date: Tue, 19 Mar 2013 19:50:30 +0000 Subject: [PATCH] Added Rectangle::toDouble() method --- modules/juce_graphics/geometry/juce_Rectangle.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/juce_graphics/geometry/juce_Rectangle.h b/modules/juce_graphics/geometry/juce_Rectangle.h index 96440a5932..13f7c0689c 100644 --- a/modules/juce_graphics/geometry/juce_Rectangle.h +++ b/modules/juce_graphics/geometry/juce_Rectangle.h @@ -700,6 +700,16 @@ public: static_cast (w), static_cast (h)); } + /** Casts this rectangle to a Rectangle. + Obviously this is mainly useful for rectangles that use integer types. + @see getSmallestIntegerContainer + */ + Rectangle toDouble() const noexcept + { + return Rectangle (static_cast (pos.x), static_cast (pos.y), + static_cast (w), static_cast (h)); + } + //============================================================================== /** Static utility to intersect two sets of rectangular co-ordinates. Returns false if the two regions didn't overlap.