Regression: DropShadows render incorrectly for Paths on macOS

The GPU-based DropShadows for paths do not draw correctly on macOS using JUCE 8.0.6.

I am trying to migrate from drawForRectangle() because it is now slowish on D2D.

drawForRectangle stayed the same since before the J8 shadow optimizations as it is a gradient based ‘trick’.

I made this code to compare it against drawForPath:

void MainComponent::paint (juce::Graphics& g)
{
    g.fillAll (juce::Colours::grey);

	juce::DropShadow ds(juce::Colours::black.withAlpha(0.7f), 10, {1, 2});

    // Top (clipped)
	juce::Path p3;
	p3.addRectangle(juce::Rectangle<int>{0, -11, getWidth(), 10});
	ds.drawForPath(g, p3);

    // Left
	ds.drawForRectangle(g, {80, 80, 40, 40});

    // Middle
	juce::Path p;
	p.addRectangle(juce::Rectangle<int>(160, 80, 40, 40));
	ds.drawForPath(g, p);

    // Right
	juce::Path p2;
	p2.addEllipse(juce::Rectangle<float>(240, 80, 40, 40));
	ds.drawForPath(g, p2);
}

This is result on macOS (tested on multiple macOS versions):

Same code on Windows 11 using the D2D renderer:

The Windows version is the way it should render IMHO - macOS is bugged and it makes my UI look very bad, the shadow all have hard borders now :frowning: .

The macOS drawing result looks like something is wrong with the alpha channel. Maybe there is some mismatch or premultiplied alpha and non-premultiplied alpha going on?

I found out this has been working correctly in 8.0.5 and is a regression from recent changes, so I did a git bisect and found the commit that broke the DropShadow for Path rendering:

@reuk, I think the changes to CoreGraphicsContext need another look.

This is how my example app looks before and after the commit.
Before:


After:

Code:
ShadowIssues.zip (4.6 KB)

Hmm… besides no longer rendering correctly I also see a massive performance problem with applyFilterInArea<>. My plugin is no longer able to hold 60fps rendering with about 10 small DropShadows visible. :confused:

And yes, this is of course with a release build. Somehow these changes seem to have imported similar issues to macOS as we’ve been seeing with D2D on Windows.

This thread was no longer accessible for some reason and now has been somehow resurrected.

I already started another one where the discussion continues: