# Regression: DropShadows render incorrectly for Paths on macOS

**URL:** <https://forum.juce.com/t/regression-dropshadows-render-incorrectly-for-paths-on-macos/65109>\
**Category:** MacOSX and iOS\
**Created:** [February 5, 2025, 7:51am UTC](https://forum.juce.com/t/regression-dropshadows-render-incorrectly-for-paths-on-macos/65109 "2025-02-05T07:51:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pflugshaupt](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pflugshaupt/32/13206_2.png) [@pflugshaupt](https://forum.juce.com/u/pflugshaupt)\
**Post date:** [February 5, 2025, 7:51am UTC](https://forum.juce.com/t/regression-dropshadows-render-incorrectly-for-paths-on-macos/65109/1 "2025-02-05T07:51:36Z")

</div>

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:

```auto
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):

 ![shadowissues_macOs14](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/b/d/bd8e0c515d547ba20abec2c0b2d4a38b09ccd428.png)

Same code on Windows 11 using the D2D renderer:

 ![shadowissues_150](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/8/0/80297057fb7b0f583407e16b5fea68efcb21dad1.png)

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 ☹ .

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?

---

<div class="post-metadata">

**Author:** ![pflugshaupt](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pflugshaupt/32/13206_2.png) [@pflugshaupt](https://forum.juce.com/u/pflugshaupt)\
**Post date:** [February 5, 2025, 9:23am UTC](https://forum.juce.com/t/regression-dropshadows-render-incorrectly-for-paths-on-macos/65109/2 "2025-02-05T09:23:21Z")

</div>

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:

> <https://github.com/juce-framework/JUCE/commit/ada2c88b033a0077089c560194e2b3a776f6ca14>

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

---

<div class="post-metadata">

**Author:** ![pflugshaupt](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pflugshaupt/32/13206_2.png) [@pflugshaupt](https://forum.juce.com/u/pflugshaupt)\
**Post date:** [February 5, 2025, 9:34am UTC](https://forum.juce.com/t/regression-dropshadows-render-incorrectly-for-paths-on-macos/65109/3 "2025-02-05T09:34:48Z")

</div>

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

 ![Screenshot 2025-02-05 at 10.33.13](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/d/a/daab8c33e5444ffa27a3624e052fea127fbbd006.png)  
After:  
 ![Screenshot 2025-02-05 at 08.36.33](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/a/2/a2821807fcad239b0f7811c449b5abed32f3bed3.png)

Code:  
[ShadowIssues.zip](https://forum.juce.com/uploads/short-url/xiK6IhZ9LKehEQrVijwhhtXUFsU.zip) (4.6 KB)

---

<div class="post-metadata">

**Author:** ![pflugshaupt](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pflugshaupt/32/13206_2.png) [@pflugshaupt](https://forum.juce.com/u/pflugshaupt)\
**Post date:** [February 5, 2025, 10:54am UTC](https://forum.juce.com/t/regression-dropshadows-render-incorrectly-for-paths-on-macos/65109/4 "2025-02-05T10:54:20Z")

</div>

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. 😕

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.

---

<div class="post-metadata">

**Author:** ![pflugshaupt](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pflugshaupt/32/13206_2.png) [@pflugshaupt](https://forum.juce.com/u/pflugshaupt)\
**Post date:** [February 5, 2025, 7:10pm UTC](https://forum.juce.com/t/regression-dropshadows-render-incorrectly-for-paths-on-macos/65109/5 "2025-02-05T19:10:12Z")

</div>

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

I already started another one where the discussion continues:

> [@\[Bug\] DropShadow draws incorrect shadows for Paths on macOS](https://forum.juce.com/t/bug-dropshadow-draws-incorrect-shadows-for-paths-on-macos/65113):
>
> Curious… I spent hours researching a problem in Juce develop 8.0.6 today and now the thread with my findings seems gone. Luckily, I don’t mind posting again. The previous thread has been made private for some reason… Why would that happen? [https://forum.juce.com/t/dropshadow-renders-incorrectly-for-paths-on-macos/65109](https://forum.juce.com/t/dropshadow-renders-incorrectly-for-paths-on-macos/65109) To sum it up. Since this commit: DropShadow renders incorrect shadows on macOS for Paths and is very slow. I wrote some test code: void MainComponent::paint (juce::Graphics&…
