diff --git a/modules/juce_graphics/contexts/juce_GraphicsContext.cpp b/modules/juce_graphics/contexts/juce_GraphicsContext.cpp index 3442b1d40b..a0dcd80fd0 100644 --- a/modules/juce_graphics/contexts/juce_GraphicsContext.cpp +++ b/modules/juce_graphics/contexts/juce_GraphicsContext.cpp @@ -438,14 +438,14 @@ void Graphics::drawRect (Rectangle r, const float lineThickness) const //============================================================================== void Graphics::fillEllipse (const Rectangle& area) const { - fillEllipse (area.getX(), area.getY(), area.getWidth(), area.getHeight()); + Path p; + p.addEllipse (area); + fillPath (p); } -void Graphics::fillEllipse (float x, float y, float width, float height) const +void Graphics::fillEllipse (float x, float y, float w, float h) const { - Path p; - p.addEllipse (x, y, width, height); - fillPath (p); + fillEllipse (Rectangle (x, y, w, h)); } void Graphics::drawEllipse (float x, float y, float width, float height, float lineThickness) const diff --git a/modules/juce_graphics/geometry/juce_Path.cpp b/modules/juce_graphics/geometry/juce_Path.cpp index 210844aab6..5a6b2f8662 100644 --- a/modules/juce_graphics/geometry/juce_Path.cpp +++ b/modules/juce_graphics/geometry/juce_Path.cpp @@ -436,9 +436,7 @@ void Path::addRectangle (const float x, const float y, data.elements [numElements++] = closeSubPathMarker; } -void Path::addRoundedRectangle (const float x, const float y, - const float w, const float h, - float csx, float csy) +void Path::addRoundedRectangle (float x, float y, float w, float h, float csx, float csy) { addRoundedRectangle (x, y, w, h, csx, csy, true, true, true, true); } @@ -498,9 +496,7 @@ void Path::addRoundedRectangle (const float x, const float y, const float w, con closeSubPath(); } -void Path::addRoundedRectangle (const float x, const float y, - const float w, const float h, - float cs) +void Path::addRoundedRectangle (float x, float y, float w, float h, float cs) { addRoundedRectangle (x, y, w, h, cs, cs); } @@ -527,15 +523,19 @@ void Path::addQuadrilateral (const float x1, const float y1, closeSubPath(); } -void Path::addEllipse (const float x, const float y, - const float w, const float h) +void Path::addEllipse (float x, float y, float w, float h) { - const float hw = w * 0.5f; + addEllipse (Rectangle (x, y, w, h)); +} + +void Path::addEllipse (Rectangle area) +{ + const float hw = area.getWidth() * 0.5f; const float hw55 = hw * 0.55f; - const float hh = h * 0.5f; + const float hh = area.getHeight() * 0.5f; const float hh55 = hh * 0.55f; - const float cx = x + hw; - const float cy = y + hh; + const float cx = area.getX() + hw; + const float cy = area.getY() + hh; startNewSubPath (cx, cy - hh); cubicTo (cx + hw55, cy - hh, cx + hw, cy - hh55, cx + hw, cy); diff --git a/modules/juce_graphics/geometry/juce_Path.h b/modules/juce_graphics/geometry/juce_Path.h index 7e364aa7da..ac319f96f3 100644 --- a/modules/juce_graphics/geometry/juce_Path.h +++ b/modules/juce_graphics/geometry/juce_Path.h @@ -391,13 +391,17 @@ public: float x4, float y4); /** Adds an ellipse to the path. - The shape is added as a new sub-path. (Any currently open paths will be left open). - @see addArc */ void addEllipse (float x, float y, float width, float height); + /** Adds an ellipse to the path. + The shape is added as a new sub-path. (Any currently open paths will be left open). + @see addArc + */ + void addEllipse (Rectangle area); + /** Adds an elliptical arc to the current path. Note that when specifying the start and end angles, the curve will be drawn either clockwise diff --git a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp index c01c8f7575..4e832af85c 100644 --- a/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp +++ b/modules/juce_gui_basics/lookandfeel/juce_LookAndFeel_V2.cpp @@ -452,8 +452,7 @@ void LookAndFeel_V2::drawAlertBox (Graphics& g, AlertWindow& alert, colour = alert.getAlertType() == AlertWindow::InfoIcon ? (uint32) 0x605555ff : (uint32) 0x40b69900; character = alert.getAlertType() == AlertWindow::InfoIcon ? 'i' : '?'; - icon.addEllipse ((float) iconRect.getX(), (float) iconRect.getY(), - (float) iconRect.getWidth(), (float) iconRect.getHeight()); + icon.addEllipse (iconRect.toFloat()); } GlyphArrangement ga;