Hello!
I’ve encountered what seems to be a bug in JUCE 8, which, by the way, is very promising. I can easily reproduce this issue using the audio plugin demo “Hello World.”
Here’s a brief overview of the issue:
In Editor class, I declare a std::unique_ptr<Image>:
std::unique_ptr<Image> MyImage;
In the editor constructor, I initialize the image like this:
AudioPluginAudioProcessorEditor::AudioPluginAudioProcessorEditor (AudioPluginAudioProcessor& p)
: AudioProcessorEditor (&p), processorRef (p)
{
juce::ignoreUnused (processorRef);
setSize (400, 300);
MyImage = std::make_unique<juce::Image>(juce::Image::ARGB, 200, 200, true);
}
However, in the paint method, I encounter an assertion failure when attempting to clear a portion of MyImage:
void AudioPluginAudioProcessorEditor::paint (juce::Graphics& g)
{
// Fill the background with a solid color
g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));
g.setColour (juce::Colours::white);
g.setFont (15.0f);
g.drawFittedText ("Hello World!", getLocalBounds(), juce::Justification::centred, 1);
juce::Graphics goff (*MyImage);
goff.fillAll (juce::Colours::green);
juce::Rectangle<int> area (20, 20, 60, 60);
MyImage->clear (area); // ASSERT HERE IN D2D
if (MyImage != nullptr && MyImage->isValid())
g.drawImageAt (*MyImage, 0, 0, false);
}
If I remove the MyImage->clear(area); line, the green square is drawn without any issues.
My setup:
- OS: Microsoft Windows 11 Home, Version 10.0.22621 Build 22621
- System Type: x64-based PC
- Processor: AMD Ryzen 7 5700U with Radeon Graphics, 1801 MHz, 8 Core(s), 16 Logical Processor(s)
- Adapter Type: AMD Radeon Graphics Processor (0x164C), Advanced Micro Devices, Inc. compatible
Could I be doing something wrong here, or is this a bug in JUCE 8?
Thanks in advance for any help!
