[lasem] svg_filter: fix blur offset.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [lasem] svg_filter: fix blur offset.
- Date: Thu, 18 Oct 2012 09:38:03 +0000 (UTC)
commit 0ed068b374ac43ced3435aa22487640d536aef67
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Thu Oct 18 11:35:38 2012 +0200
svg_filter: fix blur offset.
For small stdDeviation value, we should use another algorithm, as
no blur is applied.
src/lsmcairo.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/lsmcairo.c b/src/lsmcairo.c
index cde77b9..c1c408c 100644
--- a/src/lsmcairo.c
+++ b/src/lsmcairo.c
@@ -256,8 +256,20 @@ lsm_filter_surface_fast_blur (LsmFilterSurface *input,
cairo_surface_flush (input->surface);
- kx = floor (sx * 3 * sqrt (2 * M_PI) / 4 + 0.5);
- ky = floor (sy * 3 * sqrt (2 * M_PI) / 4 + 0.5);
+ /* Original intermediate surface size calculation was:
+ *
+ * kx = floor (sx * 3 * sqrt (2 * M_PI) / 4 + 0.5);
+ * ky = floor (sy * 3 * sqrt (2 * M_PI) / 4 + 0.5);
+ *
+ * Which has the drawback to give a surface with even dimensions, leading
+ * to a blur with a one pixel offset.
+ * The new dimensions are now always odd.
+ *
+ * 0.94 = 3.0 * sqrt(2*M_PI) / 8.0
+ */
+
+ kx = round (sx * 0.94 - 0.5) * 2.0 + 1.5;
+ ky = round (sy * 0.94 - 0.5) * 2.0 + 1.5;
if (kx < 1 && ky < 1)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]