[libbreezecommon] Use box blur instead of FFT blur

Authored by zzag on Sep 14 2018, 6:41 PM.

Description

[libbreezecommon] Use box blur instead of FFT blur

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:

After:

Before:

After:

As a win, it takes much less time to generate decoration shadows.

Reviewers: KWin, Plasma, Breeze, VDG, ngraham

Reviewed By: Breeze, VDG, ngraham

Subscribers: cfeck, ngraham, abetts, plasma-devel

Tags: Plasma

Differential Revision: https://phabricator.kde.org/D15514

Details

Committed
zzagOct 27 2018, 12:25 PM
Reviewer
Breeze
Differential Revision
D15514: [libbreezecommon] Use box blur instead of FFT blur
Parents
R31:cef36ae4cdae: SVN_SILENT made messages (.desktop file) - always resolve ours
Branches
Unknown
Tags
Unknown