1
## Description: Simulate the weight distribution of the current LS blur.
2
## For odd numbers of non-zero samples drop the last, sacrificing a
3
## little more accuracy for speed.
4
## Origin/Author: John S. Gruber <JohnSGruber@gmail.com>
5
## Depends upon: 02-ubuntu-ls-blur-return.patch 03-ubuntu-ls-blur-loop-fix.patch
6
## Bug: https://bugs.launchpad.net/ubuntu/+source/nux/+bug/1167018
7
--- a/NuxGraphics/GraphicsEngine.cpp
8
+++ b/NuxGraphics/GraphicsEngine.cpp
11
// Go through the gaussian points pair by pair and find a composite
12
// offset and weight to represent each pair
13
- for (int i = 1; i <= support; i+=2)
14
+ for (int i = 1; i < support; i+=2)
16
float w1 = exp(-(i*i)/(2*sigma*sigma))/(sqrt(2*constants::pi)*sigma);
17
float w2 = exp(-((i+1)*(i+1))/(2*sigma*sigma))/(sqrt(2*constants::pi)*sigma);
18
@@ -1364,6 +1364,10 @@
19
// and should not be sampled--make the last sample offset exactly i.
20
if (i+1 > support) w2 = 0;
22
+ // Emulate weights used previously to produce comparable blur
26
weights.push_back(w1 + w2);
27
total += 2.0f * (w1 + w2);