From 36da8b05dd3493b8661fbf71d9b3f3cc4f5bb421 Mon Sep 17 00:00:00 2001 From: sam Date: Sat, 2 Aug 2008 00:01:20 +0000 Subject: [PATCH] * pixels.c: fix a typo in the dithering method that could cause crashes. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2636 92316355-f0b4-4df1-b90c-862c8a59935f --- pipi/pixels.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pipi/pixels.c b/pipi/pixels.c index 3fd0a9d..45bb3a4 100644 --- a/pipi/pixels.c +++ b/pipi/pixels.c @@ -135,7 +135,7 @@ pipi_pixels_t *pipi_getpixels(pipi_image_t *img, pipi_format_t type) src[4 * (y * img->w + x + 1) + i] += e * .4375; if(y < img->h - 1) { - if(x < img->w - 1) + if(x > 0) src[4 * ((y + 1) * img->w + x - 1) + i] += e * .1875; src[4 * ((y + 1) * img->w + x) + i] += e * .3125; if(x < img->w - 1) @@ -171,7 +171,7 @@ pipi_pixels_t *pipi_getpixels(pipi_image_t *img, pipi_format_t type) src[4 * (y * img->w + x + 1) + i] += e * .4375; if(y < img->h - 1) { - if(x < img->w - 1) + if(x > 0) src[4 * ((y + 1) * img->w + x - 1) + i] += e * .1875; src[4 * ((y + 1) * img->w + x) + i] += e * .3125; if(x < img->w - 1)