D15514: [libbreezecommon] Use box blur instead of FFT approach
Vlad Zagorodniy
noreply at phabricator.kde.org
Fri Sep 14 21:12:32 BST 2018
zzag created this revision.
zzag added reviewers: KWin, Plasma.
Herald added a project: Plasma.
Herald added a subscriber: plasma-devel.
zzag requested review of this revision.
REVISION SUMMARY
Creation of shadows (especially for "Large" and "Very large" sizes) is
a computation expensive task because we have to blur alpha channel of a
shadow texture (which then will be tinted with desired shadow color).
Currently, we use the following approach:
- for blur radius less than 64, use naive 2-pass algorithm;
- for blur radius greater than or equal to 64, use FFT.
Even though the FFT approach is doing its the best, it still takes
impresive amount of time to blur the alpha channel.
What makes things even worse is that while we're blurring the alpha
channel, we're blocking the main thread of KWin (decorations are not
rendered in their own thread). This can result in frame drops (2 or 3
frames, something like that).
So, the only viable alternative is to use an approximation of the Gaussian
blur. As such an approximation, I picked the box blur because it's quite
simple, it's fast, and it takes small amount of iterations to have something
similar to the true Gaussian blur.
In general, there are no big differences between true gaussian shadows
and approximated shadows:
Before:
F6264173: FFT shadows <https://phabricator.kde.org/F6264173>
After:
F6264175: after.png <https://phabricator.kde.org/F6264175>
As a win, it takes much less time to generate decoration shadows.
REPOSITORY
R31 Breeze
BRANCH
zzag/box-shadow-helper-box-blur
REVISION DETAIL
https://phabricator.kde.org/D15514
AFFECTED FILES
CMakeLists.txt
cmake/Modules/FindFFTW.cmake
libbreezecommon/CMakeLists.txt
libbreezecommon/breezeboxshadowhelper.cpp
To: zzag, #kwin, #plasma
Cc: plasma-devel, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20180914/2945ce5b/attachment.html>
More information about the Plasma-devel
mailing list