Improve the nodes' drop shadow by making it scale with the view and
replace the loop for the alpha calculation with something more explicit.
---
**Issue**
The amount of the drop shadow softness (meaning the width of the faded
border) was scaled with the zoom level and therefore had a fixed
screen space size.
So when zooming in and out of the node editor the shadow would appear
to grow and shrink in relation to the node.
DPI and UI scale on the other hand was't taken into account.
This patch fixes both by basing the shadow softness on the `widget_unit`
that scales correctly in zoomable views and takes UI scale etc. into
account.
| | **master** | **patch** |
| --- | --- | --- |
| **normal DPI** | {F12027161} | {F12027175} |
| **high DPI** | {F12027186} | {F12027201} |
**Changed Alpha Calculation**
It seems like the pre-2.80 drop shadow was just drawing a bunch of
rounded boxes with very little opacity and, when the method was
changed, the alpha was still computed in the same loop to keep the
same apparent brightness.
I plotted the resulting alpha in relation to the input alpha to see
what function we could use to replace the loop.
To me it seems like simply taking half the input alpha is a close enough
fit for the interval [0, 1]. (`0.47` would be a bit closer, but `0.5`
looked nice in the code :) )
I'll gladly find a closer approximation, if that's desired. Replacing
that loop with something more explicit is great either way.
Here is a graph of the linear alpha used in the patch compared to the
results we get in master:
{F12027212, size=full}