Browse Source

Avoid calling Graphics::fillEllipse() with negative bounds in AudioAppDemo

tags/2021-05-28
ed 6 years ago
parent
commit
18571feb61
1 changed files with 9 additions and 5 deletions
  1. +9
    -5
      examples/Audio/AudioAppDemo.h

+ 9
- 5
examples/Audio/AudioAppDemo.h View File

@@ -122,11 +122,15 @@ public:
auto centreY = getHeight() / 2.0f;
auto radius = amplitude * 200.0f;
// Draw an ellipse based on the mouse position and audio volume
g.setColour (Colours::lightgreen);
g.fillEllipse (jmax (0.0f, lastMousePosition.x) - radius / 2.0f,
jmax (0.0f, lastMousePosition.y) - radius / 2.0f,
radius, radius);
if (radius >= 0.0f)
{
// Draw an ellipse based on the mouse position and audio volume
g.setColour (Colours::lightgreen);
g.fillEllipse (jmax (0.0f, lastMousePosition.x) - radius / 2.0f,
jmax (0.0f, lastMousePosition.y) - radius / 2.0f,
radius, radius);
}
// Draw a representative sine wave.
Path wavePath;


Loading…
Cancel
Save