|
|
@ -49,9 +49,11 @@ blur_surface(cairo_surface_t *surface, int margin) |
|
|
|
dst = malloc(height * stride); |
|
|
|
dst = malloc(height * stride); |
|
|
|
|
|
|
|
|
|
|
|
half = size / 2; |
|
|
|
half = size / 2; |
|
|
|
|
|
|
|
a = 0; |
|
|
|
for (i = 0; i < size; i++) { |
|
|
|
for (i = 0; i < size; i++) { |
|
|
|
f = (i - half); |
|
|
|
f = (i - half); |
|
|
|
kernel[i] = exp(- f * f / ARRAY_LENGTH(kernel)) * 10000; |
|
|
|
kernel[i] = exp(- f * f / ARRAY_LENGTH(kernel)) * 10000; |
|
|
|
|
|
|
|
a += kernel[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < height; i++) { |
|
|
|
for (i = 0; i < height; i++) { |
|
|
@ -67,7 +69,6 @@ blur_surface(cairo_surface_t *surface, int margin) |
|
|
|
y = 0; |
|
|
|
y = 0; |
|
|
|
z = 0; |
|
|
|
z = 0; |
|
|
|
w = 0; |
|
|
|
w = 0; |
|
|
|
a = 0; |
|
|
|
|
|
|
|
for (k = 0; k < size; k++) { |
|
|
|
for (k = 0; k < size; k++) { |
|
|
|
if (j - half + k < 0 || j - half + k >= width) |
|
|
|
if (j - half + k < 0 || j - half + k >= width) |
|
|
|
continue; |
|
|
|
continue; |
|
|
@ -77,7 +78,6 @@ blur_surface(cairo_surface_t *surface, int margin) |
|
|
|
y += ((p >> 16) & 0xff) * kernel[k]; |
|
|
|
y += ((p >> 16) & 0xff) * kernel[k]; |
|
|
|
z += ((p >> 8) & 0xff) * kernel[k]; |
|
|
|
z += ((p >> 8) & 0xff) * kernel[k]; |
|
|
|
w += (p & 0xff) * kernel[k]; |
|
|
|
w += (p & 0xff) * kernel[k]; |
|
|
|
a += kernel[k]; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
d[j] = (x / a << 24) | (y / a << 16) | (z / a << 8) | w / a; |
|
|
|
d[j] = (x / a << 24) | (y / a << 16) | (z / a << 8) | w / a; |
|
|
|
} |
|
|
|
} |
|
|
@ -96,7 +96,6 @@ blur_surface(cairo_surface_t *surface, int margin) |
|
|
|
y = 0; |
|
|
|
y = 0; |
|
|
|
z = 0; |
|
|
|
z = 0; |
|
|
|
w = 0; |
|
|
|
w = 0; |
|
|
|
a = 0; |
|
|
|
|
|
|
|
for (k = 0; k < size; k++) { |
|
|
|
for (k = 0; k < size; k++) { |
|
|
|
if (i - half + k < 0 || i - half + k >= height) |
|
|
|
if (i - half + k < 0 || i - half + k >= height) |
|
|
|
continue; |
|
|
|
continue; |
|
|
@ -107,7 +106,6 @@ blur_surface(cairo_surface_t *surface, int margin) |
|
|
|
y += ((p >> 16) & 0xff) * kernel[k]; |
|
|
|
y += ((p >> 16) & 0xff) * kernel[k]; |
|
|
|
z += ((p >> 8) & 0xff) * kernel[k]; |
|
|
|
z += ((p >> 8) & 0xff) * kernel[k]; |
|
|
|
w += (p & 0xff) * kernel[k]; |
|
|
|
w += (p & 0xff) * kernel[k]; |
|
|
|
a += kernel[k]; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
d[j] = (x / a << 24) | (y / a << 16) | (z / a << 8) | w / a; |
|
|
|
d[j] = (x / a << 24) | (y / a << 16) | (z / a << 8) | w / a; |
|
|
|
} |
|
|
|
} |
|
|
|