[Bug] Recent commit breaks drop shadow and NativeImageType on external monitor

This recent commit breaks drop shadows drawn for a path and NativeImageType drawing on external monitors under specific conditions:

Here is the code I am using to test:

TestUIAudioProcessorEditor::TestUIAudioProcessorEditor (TestUIAudioProcessor& p)
    : AudioProcessorEditor (&p), audioProcessor (p)
{
    myImage = juce::Image(juce::Image::PixelFormat::ARGB, 5, 5, true, juce::NativeImageType{});
    for (int i = 0; i < 5; ++i)
        for (int j = 0; j < 5; ++j)
            myImage.setPixelAt(i, j, juce::Colours::red);

    dropShadow.colour = juce::Colours::transparentBlack.withAlpha(0.5f);
    dropShadow.radius = 20;

    // Make sure that before the constructor has finished, you've set the
    // editor's size to whatever you need it to be.
    setSize (400, 300);
}

TestUIAudioProcessorEditor::~TestUIAudioProcessorEditor()
{
}

//==============================================================================
void TestUIAudioProcessorEditor::paint (juce::Graphics& g)
{
    // (Our component is opaque, so we must completely fill the background with a solid colour)
    g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId));

    g.drawImage(myImage, juce::Rectangle<float>{ 0.f, 0.f, 5.f, 5.f});

    juce::Path p;
    p.addRoundedRectangle(getBounds().reduced(10), 10.f);
    dropShadow.drawForPath(g, p);
}

void TestUIAudioProcessorEditor::resized()
{
}

The conditions to cause the problem:

Before this commit the assert is not hit and the drop shadow renders just fine.

With this commit, everything is fine if the UI opens on the laptop and is then moved to the external monitor. It is also fine if the laptop screen is closed and the Standalone opens on the external monitor.

Let me know if you need more details

Thanks, I can reproduce the problem and there’s a fix underway.

1 Like

I have just tested the latest develop commits and this seems to be working now. Thanks!

Whoops, forgot to update this thread, sorry about that.

I expect that this patch is the one that fixes the issue:

1 Like

Haha no problem. Thanks for the work :slight_smile: