Performance issue with DropShadowEffect (macOS Mojave)

gui

#1

I’m seeing some serious performance issues coming from DropShadowEffect. Looks like it’s spending a lot of time in blurDataTriplets.

The component in question is an overlay the size of the main window with a central ‘window’ with the rest transparent. I guess the large size might be an issue here? In any case I don’t remember this being an issue before I upgraded to Mojave.


#2

Unfortunately the blur that JUCE is using is extremely slow. This also affects other things, .e.g the default LAF_V4 PopUpDisplay for sliders that want a popup-display has a shadow.

If this popup-display becomes big enough (lets go crazy and say 400x400 pixels) it gets insanely slow, because the blur-radius for the shadow behind the popup-display is getting quite big.

For my own projects I’ve used a C/C++ version of Mario Klingemans StackBlur algorithm:

http://vitiy.info/stackblur-algorithm-multi-threaded-blur-for-cpp/

I’ve adapted that version to not use multi-threading, but it’s still easily fast enough for real-time usage.

In your case you would need to override some functions in the DropShadowEffect class to utilize the more efficient StackBlur algorithm. I’ve used it directly to blur image data I generate and then cache the result.