From 39a1727223c895dd37e52836641bd6064021ebd6 Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 1 Jun 2015 12:07:27 +0100 Subject: [PATCH] Added some assertions in Graphics methods to catch negatively-sized rectangles. --- modules/juce_graphics/contexts/juce_GraphicsContext.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/juce_graphics/contexts/juce_GraphicsContext.cpp b/modules/juce_graphics/contexts/juce_GraphicsContext.cpp index a0dcd80fd0..836fd6ee3c 100644 --- a/modules/juce_graphics/contexts/juce_GraphicsContext.cpp +++ b/modules/juce_graphics/contexts/juce_GraphicsContext.cpp @@ -32,8 +32,8 @@ namespace jassert ((int) x >= -maxVal && (int) x <= maxVal && (int) y >= -maxVal && (int) y <= maxVal - && (int) w >= -maxVal && (int) w <= maxVal - && (int) h >= -maxVal && (int) h <= maxVal); + && (int) w >= 0 && (int) w <= maxVal + && (int) h >= 0 && (int) h <= maxVal); #endif return Rectangle (x, y, w, h); @@ -427,6 +427,8 @@ void Graphics::drawRect (const Rectangle& r, int lineThickness) const void Graphics::drawRect (Rectangle r, const float lineThickness) const { + jassert (r.getWidth() >= 0.0f && r.getHeight() >= 0.0f); + RectangleList rects; rects.addWithoutMerging (r.removeFromTop (lineThickness)); rects.addWithoutMerging (r.removeFromBottom (lineThickness));