From b473f55d2fd7a693b33f6281f41d78db8b5e1b0b Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 8 Jul 2009 23:38:27 +0000 Subject: [PATCH] Do not touch alpha values when modifying brightness or contrast. git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@3544 92316355-f0b4-4df1-b90c-862c8a59935f --- pipi/filter/color.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pipi/filter/color.c b/pipi/filter/color.c index 529faf5..bbc191b 100644 --- a/pipi/filter/color.c +++ b/pipi/filter/color.c @@ -70,7 +70,7 @@ pipi_image_t *pipi_brightness(pipi_image_t *src, double val) p = srcdata[d + 2]; dstdata[d + 2] = p < 1. - val ? p + val : 1.; p = srcdata[d + 3]; - dstdata[d + 3] = p < 1. - val ? p + val : 1.; + dstdata[d + 3] = p; } } } @@ -98,7 +98,7 @@ pipi_image_t *pipi_brightness(pipi_image_t *src, double val) p = srcdata[d + 2]; dstdata[d + 2] = p > -val ? p + val : 0.; p = srcdata[d + 3]; - dstdata[d + 3] = p > -val ? p + val : 0.; + dstdata[d + 3] = p; } } } @@ -156,7 +156,7 @@ pipi_image_t *pipi_contrast(pipi_image_t *src, double val) p = (srcdata[d + 2] - 0.5) * val + 0.5; dstdata[d + 2] = p < 0. ? 0. : p > 1. ? 1. : p; p = (srcdata[d + 3] - 0.5) * val + 0.5; - dstdata[d + 3] = p < 0. ? 0. : p > 1. ? 1. : p; + dstdata[d + 3] = p; } } } @@ -189,7 +189,7 @@ pipi_image_t *pipi_contrast(pipi_image_t *src, double val) p = srcdata[d + 2]; dstdata[d + 2] = (p - 0.5) * val + 0.5; p = srcdata[d + 3]; - dstdata[d + 3] = (p - 0.5) * val + 0.5; + dstdata[d + 3] = p; } } }