From: Ilia Alshanetsky Date: Tue, 4 Nov 2003 01:56:07 +0000 (+0000) Subject: MFH: Fixed bug #26097 (gdImageColorClosestAlpha() returns incorrect X-Git-Tag: php-4.3.5RC1~246 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=00203d2968e143bc60eb55cdc2ffeaa8dba8161c;p=php MFH: Fixed bug #26097 (gdImageColorClosestAlpha() returns incorrect results). --- diff --git a/NEWS b/NEWS index 5bb30c792b..fbcb8a8cc1 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ PHP 4 NEWS ?? ??? 2003, Version 4.3.5 - Fixed header handler in NSAPI SAPI module (header->replace was ignored, send_default_content_type now sends value from php.ini). (Uwe Schindler) +- Fixed bug #26097 (gdImageColorClosestAlpha() returns incorrect results). + (sprice at wisc dot edu, Ilia) - Fixed bug #26042 (memory leak if mcrypt_generic_deinit() is not called after every mcrypt_generic_init() call). (Ilia) - Fixed bug #26025 (Segfault on glob() without GLOB_NOCHECK or GLOB_NOMAGIC diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index 0befc9074f..c74d55d029 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -255,7 +255,7 @@ int gdImageColorClosestAlpha (gdImagePtr im, int r, int g, int b, int a) gd = im->green[i] - g; bd = im->blue[i] - b; /* gd 2.02: whoops, was - b (thanks to David Marwood) */ - ad = im->blue[i] - a; + ad = im->alpha[i] - a; dist = rd * rd + gd * gd + bd * bd + ad * ad; if (first || (dist < mindist)) { mindist = dist;