This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, generate has been updated
via 4c68110cd82c373fe1d0c19ca01362edb452a0ad (commit)
from 96956ac4fbd2c35d57c122ecd44a88c352153a5e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/4c68110cd82c373fe1d0c19ca01362edb452…
commit 4c68110cd82c373fe1d0c19ca01362edb452a0ad
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat Oct 1 15:48:36 2011 +0200
Fix linear convolution corner cases at the corners.
diff --git a/libs/filters/GP_Linear.c b/libs/filters/GP_Linear.c
index bf41660..764d6b6 100644
--- a/libs/filters/GP_Linear.c
+++ b/libs/filters/GP_Linear.c
@@ -101,7 +101,7 @@ static void GP_FilterLinearConvolution(const GP_Context *src, GP_Context *dst,
if (cy >= (int)src->h)
cy = src->h - 1;
-
+
pix = GP_GetPixel_Raw_24BPP(src, cx, cy);
R[i][j] = GP_Pixel_GET_R_RGB888(pix);
@@ -117,14 +117,18 @@ static void GP_FilterLinearConvolution(const GP_Context *src, GP_Context *dst,
for (j = 0; j < kh; j++) {
int cy = y + j - kh/2;
-
+ int cx = x + kw/2;
+
if (cy < 0)
cy = 0;
-
+
if (cy >= (int)src->h)
cy = src->h - 1;
- pix = GP_GetPixel_Raw_24BPP(src, x, cy);
+ if (cx >= (int)src->w)
+ cx = src->w - 1;
+
+ pix = GP_GetPixel_Raw_24BPP(src, cx, cy);
R[idx][j] = GP_Pixel_GET_R_RGB888(pix);
G[idx][j] = GP_Pixel_GET_G_RGB888(pix);
@@ -133,10 +137,12 @@ static void GP_FilterLinearConvolution(const GP_Context *src, GP_Context *dst,
/* count the pixel value from neighbours weighted by kernel */
for (i = 0; i < kw; i++) {
- int k = i - idx;
-
- if (k < 0)
- k += kw;
+ int k;
+
+ if ((int)i < idx + 1)
+ k = kw - idx - 1 + i;
+ else
+ k = i - idx - 1;
for (j = 0; j < kh; j++) {
r += R[i][j] * kernel[k + j * kw];
-----------------------------------------------------------------------
Summary of changes:
libs/filters/GP_Linear.c | 22 ++++++++++++++--------
1 files changed, 14 insertions(+), 8 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")