[gnome-shell] st: Fix Gaussian kernel calculation
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] st: Fix Gaussian kernel calculation
- Date: Thu, 12 Nov 2015 00:02:33 +0000 (UTC)
commit 9a7b47c23f676cdfc80758ee45a4bc0cada83243
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Nov 12 00:42:36 2015 +0100
st: Fix Gaussian kernel calculation
The result of subtracting unsigned operands is unsigned, which throws
off our calculation in case it should be negative.
This partly reverts 18b6f133952.
https://bugzilla.gnome.org/show_bug.cgi?id=757779
src/st/st-private.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/st/st-private.c b/src/st/st-private.c
index 9ff469a..559336c 100644
--- a/src/st/st-private.c
+++ b/src/st/st-private.c
@@ -211,7 +211,7 @@ calculate_gaussian_kernel (gdouble sigma,
{
gdouble *ret, sum;
gdouble exp_divisor;
- guint half, i;
+ int half, i;
g_return_val_if_fail (sigma > 0, NULL);
@@ -223,14 +223,14 @@ calculate_gaussian_kernel (gdouble sigma,
exp_divisor = 2 * sigma * sigma;
/* n_values of 1D Gauss function */
- for (i = 0; i < n_values; i++)
+ for (i = 0; i < (int)n_values; i++)
{
ret[i] = exp (-(i - half) * (i - half) / exp_divisor);
sum += ret[i];
}
/* normalize */
- for (i = 0; i < n_values; i++)
+ for (i = 0; i < (int)n_values; i++)
ret[i] /= sum;
return ret;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]