diff options
author | Alexander Larsson <alexl@redhat.com> | 2015-03-19 16:25:25 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2015-03-21 20:59:57 +0100 |
commit | ae21e0878278a93b227233381e0f29c3e79980df (patch) | |
tree | 32cffd7fc507b111b0af65b4b8d176c60d30c8d2 /gtk/gtkcairoblur.c | |
parent | 9ba185b749542618bc2843517d49dc05ed006164 (diff) | |
download | gtk+-ae21e0878278a93b227233381e0f29c3e79980df.tar.gz |
gtkcairoblur: Minor restructure
This just moves get_box_filter_size to the top and makes
it a macro (so it can be used as a constant later).
https://bugzilla.gnome.org/show_bug.cgi?id=746468
Diffstat (limited to 'gtk/gtkcairoblur.c')
-rw-r--r-- | gtk/gtkcairoblur.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/gtk/gtkcairoblur.c b/gtk/gtkcairoblur.c index 406e09b914..82f5d33f48 100644 --- a/gtk/gtkcairoblur.c +++ b/gtk/gtkcairoblur.c @@ -25,6 +25,19 @@ #include <math.h> #include <string.h> +/* + * Gets the size for a single box blur. + * + * Much of this, the 3 * sqrt(2 * pi) / 4, is the known value for + * approximating a Gaussian using box blurs. This yields quite a good + * approximation for a Gaussian. For more details, see: + * http://www.w3.org/TR/SVG11/filters.html#feGaussianBlurElement + * https://bugzilla.mozilla.org/show_bug.cgi?id=590039#c19 + */ +#define GAUSSIAN_SCALE_FACTOR ((3.0 * sqrt(2 * G_PI) / 4)) + +#define get_box_filter_size(radius) ((int)(GAUSSIAN_SCALE_FACTOR * radius)) + /* This applies a single box blur pass to a horizontal range of pixels; * since the box blur has the same weight for all pixels, we can * implement an efficient sliding window algorithm where we add @@ -140,23 +153,6 @@ flip_buffer (guchar *dst_buffer, #undef BLOCK_SIZE } -/* - * Gets the size for a single box blur. - * - * Much of this, the 3 * sqrt(2 * pi) / 4, is the known value for - * approximating a Gaussian using box blurs. This yields quite a good - * approximation for a Gaussian. For more details, see: - * http://www.w3.org/TR/SVG11/filters.html#feGaussianBlurElement - * https://bugzilla.mozilla.org/show_bug.cgi?id=590039#c19 - */ -#define GAUSSIAN_SCALE_FACTOR ((3.0 * sqrt(2 * G_PI) / 4)) - -static int -get_box_filter_size (double radius) -{ - return GAUSSIAN_SCALE_FACTOR * radius; -} - static void _boxblur (guchar *buffer, int width, |