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
This commit is contained in:
committed by
Matthias Clasen
parent
813cb485b6
commit
d34f4f6f57
@@ -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
|
||||
@@ -218,8 +231,6 @@ _gtk_cairo_blur_surface (cairo_surface_t* surface,
|
||||
* 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) * 1.5)
|
||||
|
||||
int
|
||||
_gtk_cairo_blur_compute_pixels (double radius)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user