[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
pajoye Tue Jul 7 11:06:21 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/gd/libgd gd.c Log: - MF53: #45905, imagefilledrectangle() clipping error http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.29&r2=1.90.2.1.2.30&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.29 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.30 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.29 Tue Jun 23 07:09:19 2009 +++ php-src/ext/gd/libgd/gd.c Tue Jul 7 11:06:21 2009 @@ -2205,33 +2205,39 @@ { int x, y; - /* Nick Atty: limit the points at the edge. Note that this also -* nicely kills any plotting for rectangles completely outside the -* window as it makes the tests in the for loops fail -*/ - if (x1 < 0) { - x1 = 0; - } - if (x1 > gdImageSX(im)) { - x1 = gdImageSX(im); - } - if(y1 < 0) { - y1 = 0; - } - if (y1 > gdImageSY(im)) { - y1 = gdImageSY(im); + if (x1 == x2 && y1 == y2) { + gdImageSetPixel(im, x1, y1, color); + return; } + if (x1 > x2) { x = x1; x1 = x2; x2 = x; } + if (y1 > y2) { y = y1; y1 = y2; y2 = y; } + if (x1 < 0) { + x1 = 0; + } + + if (x2 >= gdImageSX(im)) { + x2 = gdImageSX(im) - 1; + } + + if (y1 < 0) { + y1 = 0; + } + + if (y2 >= gdImageSY(im)) { + y2 = gdImageSY(im) - 1; + } + for (y = y1; (y <= y2); y++) { for (x = x1; (x <= x2); x++) { gdImageSetPixel (im, x, y, color); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
kalle Tue Jun 23 07:09:19 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/gd/libgd gd.c Log: Whops, nobody saw this :) http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.28&r2=1.90.2.1.2.29&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.28 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.29 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.28 Mon Jun 22 15:52:59 2009 +++ php-src/ext/gd/libgd/gd.c Tue Jun 23 07:09:19 2009 @@ -3879,7 +3879,7 @@ } gdImageSaveAlpha(srcback, 1); new_pxl = gdImageColorAllocateAlpha(srcback, 0, 0, 0, 127); - gdImageFill(srcback, 0, 0, new_pxl; + gdImageFill(srcback, 0, 0, new_pxl); gdImageCopy(srcback, src,0,0,0,0,src->sx,src->sy); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
kalle Mon Jun 22 15:52:59 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/gd/libgd gd.c Log: Should have been in previous commit http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.27&r2=1.90.2.1.2.28&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.27 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.28 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.27 Mon Jun 22 15:51:12 2009 +++ php-src/ext/gd/libgd/gd.c Mon Jun 22 15:52:59 2009 @@ -3877,7 +3877,7 @@ if (srcback==NULL) { return 0; } - srcback->saveAlphaFlag = 1; + gdImageSaveAlpha(srcback, 1); new_pxl = gdImageColorAllocateAlpha(srcback, 0, 0, 0, 127); gdImageFill(srcback, 0, 0, new_pxl; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
kalle Mon Jun 22 15:51:13 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/gd/libgd gd.c Log: MFH: Use correct data types here, and gdImageSaveAlpha for the alpha flag http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.26&r2=1.90.2.1.2.27&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.26 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.27 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.26 Thu Apr 23 16:28:39 2009 +++ php-src/ext/gd/libgd/gd.c Mon Jun 22 15:51:12 2009 @@ -3864,7 +3864,7 @@ int x, y, i, j, new_a; float new_r, new_g, new_b; int new_pxl, pxl=0; - gdImagePtr srcback, srctrans; + gdImagePtr srcback; typedef int (*FuncPtr)(gdImagePtr, int, int); FuncPtr f; @@ -3878,8 +3878,8 @@ return 0; } srcback->saveAlphaFlag = 1; - srctrans = gdImageColorAllocateAlpha(srcback, 0, 0, 0, 127); - gdImageFill(srcback, 0, 0, srctrans); + new_pxl = gdImageColorAllocateAlpha(srcback, 0, 0, 0, 127); + gdImageFill(srcback, 0, 0, new_pxl; gdImageCopy(srcback, src,0,0,0,0,src->sx,src->sy); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
tabeThu Apr 23 16:28:39 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/gd/libgd gd.c Log: MFH: check non-null before any use. http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.25&r2=1.90.2.1.2.26&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.25 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.26 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.25 Sun Apr 12 14:44:34 2009 +++ php-src/ext/gd/libgd/gd.c Thu Apr 23 16:28:39 2009 @@ -3874,16 +3874,15 @@ /* We need the orinal image with each safe neoghb. pixel */ srcback = gdImageCreateTrueColor (src->sx, src->sy); + if (srcback==NULL) { + return 0; + } srcback->saveAlphaFlag = 1; srctrans = gdImageColorAllocateAlpha(srcback, 0, 0, 0, 127); gdImageFill(srcback, 0, 0, srctrans); gdImageCopy(srcback, src,0,0,0,0,src->sx,src->sy); - if (srcback==NULL) { - return 0; - } - f = GET_PIXEL_FUNCTION(src); for ( y=0; ysy; y++) { @@ -3940,11 +3939,10 @@ /* We need the orinal image with each safe neoghb. pixel */ srcback = gdImageCreateTrueColor (src->sx, src->sy); - gdImageCopy(srcback, src,0,0,0,0,src->sx,src->sy); - if (srcback==NULL) { return 0; } + gdImageCopy(srcback, src,0,0,0,0,src->sx,src->sy); f = GET_PIXEL_FUNCTION(src); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c /ext/gd/tests imagerotate_overflow.phpt
scottmacWed Dec 10 13:33:10 2008 UTC Added files: (Branch: PHP_5_2) /php-src/ext/gd/tests imagerotate_overflow.phpt Modified files: /php-src/ext/gd/libgd gd.c Log: MFH Fix segfault and potential security issue in imagerotate(). http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.23&r2=1.90.2.1.2.24&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.23 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.24 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.23 Thu Jul 31 09:22:17 2008 +++ php-src/ext/gd/libgd/gd.c Wed Dec 10 13:33:10 2008 @@ -3136,7 +3136,7 @@ return NULL; } - if (!gdImageTrueColor(src) && clrBack>=gdImageColorsTotal(src)) { + if (!gdImageTrueColor(src) && (clrBack < 0 || clrBack>=gdImageColorsTotal(src))) { return NULL; } http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/imagerotate_overflow.phpt?view=markup&rev=1.1 Index: php-src/ext/gd/tests/imagerotate_overflow.phpt +++ php-src/ext/gd/tests/imagerotate_overflow.phpt --TEST-- imagerotate() overflow with negative numbers --SKIPIF-- --FILE-- --EXPECT-- bool(false) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c gd_png.c
rasmus Thu Jul 31 09:22:17 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/gd/libgd gd.c gd_png.c Log: Fix for bug #45030 http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.22&r2=1.90.2.1.2.23&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.22 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.23 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.22 Sun Nov 4 23:56:00 2007 +++ php-src/ext/gd/libgd/gd.c Thu Jul 31 09:22:17 2008 @@ -2620,6 +2620,7 @@ green /= spixels; blue /= spixels; alpha /= spixels; + alpha += 0.5; } if ( alpha_sum != 0.0f) { if( contrib_sum != 0.0f) { http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd_png.c?r1=1.17.4.2.2.5&r2=1.17.4.2.2.6&diff_format=u Index: php-src/ext/gd/libgd/gd_png.c diff -u php-src/ext/gd/libgd/gd_png.c:1.17.4.2.2.5 php-src/ext/gd/libgd/gd_png.c:1.17.4.2.2.6 --- php-src/ext/gd/libgd/gd_png.c:1.17.4.2.2.5 Wed May 16 22:19:08 2007 +++ php-src/ext/gd/libgd/gd_png.c Thu Jul 31 09:22:17 2008 @@ -689,7 +689,12 @@ */ a = gdTrueColorGetAlpha(thisPixel); /* Andrew Hull: >> 6, not >> 7! (gd 2.0.5) */ - *pOutputRow++ = 255 - ((a << 1) + (a >> 6)); + if (a == 127) { + *pOutputRow++ = 0; + } else { + *pOutputRow++ = 255 - ((a << 1) + (a >> 6)); + } + } } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c /ext/gd/tests bug43121.gif bug43121.phpt
mattias Sun Nov 4 23:56:00 2007 UTC Added files: (Branch: PHP_5_2) /php-src/ext/gd/tests bug43121.gif bug43121.phpt Modified files: /php-src/ext/gd/libgd gd.c Log: - Fixed Bug #43121 (gdImageFill with IMG_COLOR_TILED crashes httpd) http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.21&r2=1.90.2.1.2.22&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.21 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.22 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.21 Tue Sep 11 21:03:48 2007 +++ php-src/ext/gd/libgd/gd.c Sun Nov 4 23:56:00 2007 @@ -2050,14 +2050,14 @@ static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc) { - int l, x1, x2, dy; + int i, l, x1, x2, dy; int oc; /* old pixel value */ int tiled; int wx2,wy2; /* stack of filled segments */ struct seg *stack; struct seg *sp; - char *pts; + char **pts; if (!im->tile) { return; @@ -2067,7 +2067,11 @@ tiled = nc==gdTiled; nc = gdImageTileGet(im,x,y); - pts = (char *) ecalloc(im->sy * im->sx, sizeof(char)); + + pts = (char **) ecalloc(im->sy + 1, sizeof(char *)); + for (i = 0; i < im->sy + 1; i++) { + pts[i] = (char *) ecalloc(im->sx + 1, sizeof(char)); + } stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); sp = stack; @@ -2080,9 +2084,9 @@ FILL_PUSH(y+1, x, x, -1); while (sp>stack) { FILL_POP(y, x1, x2, dy); - for (x=x1; x>=0 && (!pts[y + x*wx2] && gdImageGetPixel(im,x,y)==oc); x--) { + for (x=x1; x>=0 && (!pts[y][x] && gdImageGetPixel(im,x,y)==oc); x--) { nc = gdImageTileGet(im,x,y); - pts[y + x*wx2]=1; + pts[y][x] = 1; gdImageSetPixel(im,x, y, nc); } if (x>=x1) { @@ -2096,9 +2100,9 @@ } x = x1+1; do { - for (; xx2+1) { FILL_PUSH(y, x2+1, x-1, -dy); } -skip: for (x++; x<=x2 && (pts[y + x*wx2] || gdImageGetPixel(im,x, y)!=oc); x++); +skip: for(x++; x<=x2 && (pts[y][x] || gdImageGetPixel(im,x, y)!=oc); x++); l = x; } while (x<=x2); } + for(i = 0; i < im->sy + 1; i++) { + efree(pts[i]); + } + efree(pts); efree(stack); } http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/bug43121.phpt?view=markup&rev=1.1 Index: php-src/ext/gd/tests/bug43121.phpt +++ php-src/ext/gd/tests/bug43121.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
pajoye Sun Sep 9 13:05:52 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/gd/libgd gd.c Log: - re-add fix for libgd #106, imagerectangle draws 1x1 rectangles as 1x3 rectangles http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.19&r2=1.90.2.1.2.20&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.19 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.20 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.19 Mon Aug 27 08:27:45 2007 +++ php-src/ext/gd/libgd/gd.c Sun Sep 9 13:05:51 2007 @@ -2124,6 +2124,11 @@ int half1 = 1; int t; + if (x1 == x2 && y1 == y2 && thick == 1) { + gdImageSetPixel(im, x1, y1, color); + return; + } + if (y2 < y1) { t=y1; y1 = y2; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
nlopess Sun Jun 17 19:03:58 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/gd/libgd gd.c Log: malloc+memset == calloc (sync with libgd) http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.16&r2=1.90.2.1.2.17&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.16 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.17 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.16 Sun Jun 17 16:51:50 2007 +++ php-src/ext/gd/libgd/gd.c Sun Jun 17 19:03:58 2007 @@ -129,8 +129,8 @@ return NULL; } - im = (gdImage *) gdMalloc(sizeof(gdImage)); - memset(im, 0, sizeof(gdImage)); + im = (gdImage *) gdCalloc(1, sizeof(gdImage)); + /* Row-major ever since gd 1.3 */ im->pixels = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy); im->AA_opacity = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
pajoye Sun Jun 17 16:51:50 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/gd/libgd gd.c Log: - Drop useless tests (Daniel Diaz) http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.15&r2=1.90.2.1.2.16&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.15 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.16 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.15 Sun Jun 17 10:56:51 2007 +++ php-src/ext/gd/libgd/gd.c Sun Jun 17 16:51:50 2007 @@ -3657,9 +3657,7 @@ if (new_pxl == -1) { new_pxl = gdImageColorClosestAlpha(src, 255-r, 255-g, 255-b, a); } - if ((y >= 0) && (y < src->sy)) { - gdImageSetPixel (src, x, y, new_pxl); - } + gdImageSetPixel (src, x, y, new_pxl); } } return 1; @@ -3692,9 +3690,7 @@ if (new_pxl == -1) { new_pxl = gdImageColorClosestAlpha(src, r, g, b, a); } - if ((y >= 0) && (y < src->sy)) { - gdImageSetPixel (src, x, y, new_pxl); - } + gdImageSetPixel (src, x, y, new_pxl); } } return 1; @@ -3739,9 +3735,7 @@ if (new_pxl == -1) { new_pxl = gdImageColorClosestAlpha(src, (int)r, (int)g, (int)b, a); } - if ((y >= 0) && (y < src->sy)) { - gdImageSetPixel (src, x, y, new_pxl); - } + gdImageSetPixel (src, x, y, new_pxl); } } return 1; @@ -3801,9 +3795,7 @@ if (new_pxl == -1) { new_pxl = gdImageColorClosestAlpha(src, (int)rf, (int)gf, (int)bf, a); } - if ((y >= 0) && (y < src->sy)) { - gdImageSetPixel (src, x, y, new_pxl); - } + gdImageSetPixel (src, x, y, new_pxl); } } return 1; @@ -3844,9 +3836,7 @@ if (new_pxl == -1) { new_pxl = gdImageColorClosestAlpha(src, (int)r, (int)g, (int)b, a); } - if ((y >= 0) && (y < src->sy)) { - gdImageSetPixel (src, x, y, new_pxl); - } + gdImageSetPixel (src, x, y, new_pxl); } } return 1; @@ -3902,9 +3892,7 @@ if (new_pxl == -1) { new_pxl = gdImageColorClosestAlpha(src, (int)new_r, (int)new_g, (int)new_b, new_a); } - if ((y >= 0) && (y < src->sy)) { - gdImageSetPixel (src, x, y, new_pxl); - } + gdImageSetPixel (src, x, y, new_pxl); } } gdImageDestroy(srcback); @@ -4024,9 +4012,7 @@ if (new_pxl == -1) { new_pxl = gdImageColorClosestAlpha(src, (int)new_r, (int)new_g, (int)new_b, new_a); } - if ((y >= 0) && (y < src->sy)) { - gdImageSetPixel (src, x, y, new_pxl); - } + gdImageSetPixel (src, x, y, new_pxl); } } gdImageDestroy(srcback); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
On 6/15/07, Stanislav Malyshev <[EMAIL PROTECTED]> wrote: > + pts = (char *) ecalloc(im->sy * im->sx, sizeof(char)); I don't see any overflow checks around, are you sure it's safe? Checks are done in gdImageCreate* --Pierre Ah, exactly. That explains why I wasn't able to crash it :-) Nuno -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
On 6/15/07, Stanislav Malyshev <[EMAIL PROTECTED]> wrote: > + pts = (char *) ecalloc(im->sy * im->sx, sizeof(char)); I don't see any overflow checks around, are you sure it's safe? Checks are done in gdImageCreate* --Pierre -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
Ah! good point, thanks. I'll check it out. Nuno - Original Message - + pts = (char *) ecalloc(im->sy * im->sx, sizeof(char)); I don't see any overflow checks around, are you sure it's safe? -- Stanislav Malyshev, Zend Products Engineer [EMAIL PROTECTED] http://www.zend.com/ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
+ pts = (char *) ecalloc(im->sy * im->sx, sizeof(char)); I don't see any overflow checks around, are you sure it's safe? -- Stanislav Malyshev, Zend Products Engineer [EMAIL PROTECTED] http://www.zend.com/ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
nlopess Fri Jun 15 19:47:10 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/gd/libgd gd.c Log: sync with libgd: improve _gdImageFillTiled() http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.13&r2=1.90.2.1.2.14&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.13 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.14 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.13 Thu Jun 14 19:17:31 2007 +++ php-src/ext/gd/libgd/gd.c Fri Jun 15 19:47:10 2007 @@ -1943,7 +1943,7 @@ #define FILL_POP(Y, XL, XR, DY) \ {sp--; Y = sp->y+(DY = sp->dy); XL = sp->xl; XR = sp->xr;} -void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc); +static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc); void gdImageFill(gdImagePtr im, int x, int y, int nc) { @@ -2045,16 +2045,16 @@ im->alphaBlendingFlag = alphablending_bak; } -void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc) +static void _gdImageFillTiled(gdImagePtr im, int x, int y, int nc) { - int i,l, x1, x2, dy; + int l, x1, x2, dy; int oc; /* old pixel value */ int tiled; int wx2,wy2; /* stack of filled segments */ struct seg *stack; struct seg *sp; - char **pts; + char *pts; if (!im->tile) { return; @@ -2064,11 +2064,7 @@ tiled = nc==gdTiled; nc = gdImageTileGet(im,x,y); - pts = (char **) ecalloc(im->sy, sizeof(char*)); - - for (i=0; isy;i++) { - pts[i] = (char *) ecalloc(im->sx, sizeof(char)); - } + pts = (char *) ecalloc(im->sy * im->sx, sizeof(char)); stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); sp = stack; @@ -2081,9 +2077,9 @@ FILL_PUSH(y+1, x, x, -1); while (sp>stack) { FILL_POP(y, x1, x2, dy); - for (x=x1; x>=0 && (!pts[y][x] && gdImageGetPixel(im,x,y)==oc); x--) { + for (x=x1; x>=0 && (!pts[y + x*wx2] && gdImageGetPixel(im,x,y)==oc); x--) { nc = gdImageTileGet(im,x,y); - pts[y][x]=1; + pts[y + x*wx2]=1; gdImageSetPixel(im,x, y, nc); } if (x>=x1) { @@ -2097,9 +2093,9 @@ } x = x1+1; do { - for (; xx2+1) { FILL_PUSH(y, x2+1, x-1, -dy); } -skip: for (x++; x<=x2 && (pts[y][x] || gdImageGetPixel(im,x, y)!=oc); x++); +skip: for (x++; x<=x2 && (pts[y + x*wx2] || gdImageGetPixel(im,x, y)!=oc); x++); l = x; } while (x<=x2); } - for (i=0; isy;i++) { - efree(pts[i]); - } + efree(pts); efree(stack); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
pajoye Fri Mar 9 01:18:40 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/gd/libgd gd.c Log: - #40764, line thickness not respected for horizontal and vertical lines http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.9&r2=1.90.2.1.2.10&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.9 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.10 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.9 Fri Jan 19 15:03:56 2007 +++ php-src/ext/gd/libgd/gd.c Fri Mar 9 01:18:40 2007 @@ -847,7 +847,9 @@ srcy = y % gdImageSY(im->tile); if (im->trueColor) { p = gdImageGetTrueColorPixel(im->tile, srcx, srcy); - gdImageSetPixel(im, x, y, p); + if (p != gdImageGetTransparent (im->tile)) { + gdImageSetPixel(im, x, y, p); + } } else { p = gdImageGetPixel(im->tile, srcx, srcy); /* Allow for transparency */ @@ -1032,25 +1034,37 @@ /* Vertical */ if (x1==x2) { - if (y2 < y1) { - t = y2; - y2 = y1; - y1 = t; - } + if (thick > 1) { + int thickhalf = thick >> 1; + thickhalf = thick >> 1; + gdImageFilledRectangle(im, x1 - thickhalf, y1, x1 + thick - thickhalf - 1, y2, color); + } else { + if (y2 < y1) { + t = y2; + y2 = y1; + y1 = t; + } - for (;y1 <= y2; y1++) { - gdImageSetPixel(im, x1,y1, color); + for (;y1 <= y2; y1++) { + gdImageSetPixel(im, x1,y1, color); + } } return; } else if (y1==y2) {/* Horizontal */ - if (x2 < x1) { - t = x2; - x2 = x1; - x1 = t; - } + if (thick > 1) { + int thickhalf = thick >> 1; + thickhalf = thick >> 1; + gdImageFilledRectangle(im, x1, y1 - thickhalf, x2, y2 + thick - thickhalf - 1, color); + } else { + if (x2 < x1) { + t = x2; + x2 = x1; + x1 = t; + } - for (;x1 <= x2; x1++) { - gdImageSetPixel(im, x1,y1, color); + for (;x1 <= x2; x1++) { + gdImageSetPixel(im, x1,y1, color); + } } return; } @@ -3398,7 +3412,7 @@ } int -gdAlphaBlend (int dst, int src) +gdAlphaBlendOld (int dst, int src) { /* 2.0.12: TBB: alpha in the destination should be a * component of the result. Thanks to Frank Warmerdam for @@ -3420,6 +3434,51 @@ gdTrueColorGetBlue (dst)) / gdAlphaMax)); } +int gdAlphaBlend (int dst, int src) { +int src_alpha = gdTrueColorGetAlpha(src); +int dst_alpha, alpha, red, green, blue; +int src_weight, dst_weight, tot_weight; + +/* */ +/* Simple cases we want to handle fast.*/ +/* */ +if( src_alpha == gdAlphaOpaque ) +return src; + +dst_alpha = gdTrueColorGetAlpha(dst); +if( src_alpha == gdAlphaTransparent ) +return dst; +if( dst_alpha == gdAlphaTransparent ) +return src; + +/* */ +/* What will the source and destination alphas be? Note that */ +/* the destination weighting is substantially reduced as the */ +/* overlay becomes quite opaque. */ +/* */ +src_weight = gdAlphaTransparent - src_alpha; +dst_weight = (gdAlphaTransparent - dst_alpha) * src_alpha / gdAlphaMax; +tot_weight = src_weight + dst_weight; + +/* */ +/* What red, green and blue result values will we use? */ +/* */ +alpha = src_alpha * dst_alpha / gdAlphaMax; + +red = (gdTrueColorGetRed(src) * src_weight + + gdTrueColorGetRed(dst) * dst_weight) / tot_weight; +green = (gdTrueColorGetGreen(src) * src_weight + + gdTrueColorGetGreen(dst) * dst_weight) / tot_weight; +blue = (gdTrueColorGetBlue(src) * src_we
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
pajoye Fri Jan 19 15:03:56 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/gd/libgd gd.c Log: - save/restore the alpha blending mode correctly in imagefill and imagefilltoborder http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.8&r2=1.90.2.1.2.9&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.8 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.9 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.8 Sat Jan 13 11:21:21 2007 +++ php-src/ext/gd/libgd/gd.c Fri Jan 19 15:03:56 2007 @@ -1795,17 +1795,15 @@ int lastBorder; /* Seek left */ int leftLimit = -1, rightLimit; - int i, restoreAlphaBleding=0; + int i, restoreAlphaBlending = 0; if (border < 0) { /* Refuse to fill to a non-solid border */ return; } - if (im->alphaBlendingFlag) { - restoreAlphaBleding = 1; - im->alphaBlendingFlag = 0; - } + restoreAlphaBlending = im->alphaBlendingFlag; + im->alphaBlendingFlag = 0; if (x >= im->sx) { x = im->sx - 1; @@ -1822,9 +1820,7 @@ leftLimit = i; } if (leftLimit == -1) { - if (restoreAlphaBleding) { - im->alphaBlendingFlag = 1; - } + im->alphaBlendingFlag = restoreAlphaBlending; return; } /* Seek right */ @@ -1869,9 +1865,7 @@ } } } - if (restoreAlphaBleding) { - im->alphaBlendingFlag = 1; - } + im->alphaBlendingFlag = restoreAlphaBlending; } /* @@ -1908,7 +1902,7 @@ /* stack of filled segments */ /* struct seg stack[FILL_MAX],*sp = stack;; */ - struct seg *stack; + struct seg *stack = NULL; struct seg *sp; if (!im->trueColor && nc > (im->colorsTotal -1)) { @@ -1939,7 +1933,7 @@ do { c = gdImageGetPixel(im, ix, iy); if (c != oc) { - return; + goto done; } gdImageSetPixel(im, ix, iy, nc); } while(ix++ < (im->sx -1)); @@ -1947,11 +1941,11 @@ do { c = gdImageGetPixel(im, ix, iy); if (c != oc) { - return; + goto done; } gdImageSetPixel(im, ix, iy, nc); } while(ix++ < (im->sx -1)); - return; + goto done; } stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); @@ -1991,7 +1985,10 @@ l = x; } while (x<=x2); } + efree(stack); + +done: im->alphaBlendingFlag = alphablending_bak; } @@ -2025,7 +2022,7 @@ oc = gdImageGetPixel(im, x, y); - /* required! */ +/* required! */ FILL_PUSH(y,x,x,1); /* seed segment (popped 1st) */ FILL_PUSH(y+1, x, x, -1); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
Hello Nuno, On 1/14/07, Nuno Lopes <[EMAIL PROTECTED]> wrote: It is reproducible everywhere, I must say (including my pc). wx2 is the size of the array, so you can only read from idx 0 to (wx2-1). Reading idx wx2 doesn't make sense. Right, I was wondering why valgrind don't say a word here, will reinstall it... For statistics, the gcov machine has Debian stable (gcc 3.3) and a Celeron cpu. It is not only for statistic purporses. How is B true there if it must be false to enter in the 'for' loop? It can't. Anyway you are the extension maintainer, so feel free to revert the patch and/or not merge it to libgd. Long story short: I Like to keep this little comment. There is no technical reason (there was none before, as my comment said, there is still none now) to do it but I like to keep it as a comment. And I do not want to revert the patch but I will reintroduce the comment. I still ask to do not make such changes during a RC phase (optimization/cleanup should not be done during this phase), that's all :) >> The code can still be further optimized when using square images, but I >> didn't deliberately make such change in an RC phase and without your >> approval. > > I like to first see a patch for this optimization. There is many > special cases or things to worry about here and BC is important. I'm > not saying that an optimization is not possible or welcome, only that > I like to see it prior to commit. Sure. I said I wasn't going to make it for now (before php 5.2.1 is released). After that I can look at it (and no, it won't have any BC issues). You'll be the first to read it, don't worry ;) Being the first does not matter, but only before the commit, I hate arguing like we are doing now when the topic of the discussion is already in CVS :) Cheers, --Pierre -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
As the commit log says, I fixed a few valgrind warnings in the bug24594.phpt test (it was reading one past the end of the array). The log is still available at http://gcov.php.net/viewer.php?version=PHP_5_2&func=valgrind&file=ext%2Fgd%2Ftests%2Fbug24594.phpt the fix is this part: - for (; x<=wx2 && (!pts[y][x] && gdImageGetPixel(im,x, y)==oc) ; x++) { + for (; x What is the OS/compiler/cpu on this box? I remember that there was warnings/errors there but nobody else was able to reproduce. Can you reproduce this warning on your local box? It is reproducible everywhere, I must say (including my pc). wx2 is the size of the array, so you can only read from idx 0 to (wx2-1). Reading idx wx2 doesn't make sense. For statistics, the gcov machine has Debian stable (gcc 3.3) and a Celeron cpu. It is really dead code and it was even marked as such. It is impossible (excluding compiler/cpu/memory/.. bugs) to reach the code I removed. If you feel scary with such trivial changes that means the extension hasn't enough tests :P (ok, kidding. that part of the code is covered) I did not say that this code is used or reached. I said that I liked to keep it. I do feel good with this function (I will not rewrite the old one and put my result in a stable branche if I was not), that's not the question. I only liked to keep it or at the very least to put it in a comment. It helps to quickly get the whole picture when you read the function after a long time :) uhm the code was something like this: for (...; A && !B && C; ..) { if (B) { break; } How is B true there if it must be false to enter in the 'for' loop? It can't. Anyway you are the extension maintainer, so feel free to revert the patch and/or not merge it to libgd. The code can still be further optimized when using square images, but I didn't deliberately make such change in an RC phase and without your approval. I like to first see a patch for this optimization. There is many special cases or things to worry about here and BC is important. I'm not saying that an optimization is not possible or welcome, only that I like to see it prior to commit. Sure. I said I wasn't going to make it for now (before php 5.2.1 is released). After that I can look at it (and no, it won't have any BC issues). You'll be the first to read it, don't worry ;) Nuno -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
Hello Nuno, On 1/13/07, Nuno Lopes <[EMAIL PROTECTED]> wrote: > On 1/13/07, Nuno Lopes <[EMAIL PROTECTED]> wrote: >> nlopess Sat Jan 13 11:16:15 2007 UTC >> >> Modified files: (Branch: PHP_5_2) >> /php-src/ext/gd/libgd gd.c >> Log: >> fix valgrind error in test bug24594.phpt >> while at it, remove some dead code and change the pts vector to char to >> save (much) memory >> # Pierre: one more to merge ;) > > Thanks for the catch. I like to merge (and keep the fix) if I know > what you are fixing. Can you send me the details please? As the commit log says, I fixed a few valgrind warnings in the bug24594.phpt test (it was reading one past the end of the array). The log is still available at http://gcov.php.net/viewer.php?version=PHP_5_2&func=valgrind&file=ext%2Fgd%2Ftests%2Fbug24594.phpt the fix is this part: - for (; x<=wx2 && (!pts[y][x] && gdImageGetPixel(im,x, y)==oc) ; x++) { + for (; x What is the OS/compiler/cpu on this box? I remember that there was warnings/errors there but nobody else was able to reproduce. Can you reproduce this warning on your local box? > About removing the dead code, again I do not like to do it during the > RC phase. Please do it __after__ 5.2.1 (take #2) if there is a very > good reason to do it, but I like to keep it (as I voluntary kept it). It is really dead code and it was even marked as such. It is impossible (excluding compiler/cpu/memory/.. bugs) to reach the code I removed. If you feel scary with such trivial changes that means the extension hasn't enough tests :P (ok, kidding. that part of the code is covered) I did not say that this code is used or reached. I said that I liked to keep it. I do feel good with this function (I will not rewrite the old one and put my result in a stable branche if I was not), that's not the question. I only liked to keep it or at the very least to put it in a comment. It helps to quickly get the whole picture when you read the function after a long time :) >> OMG, this line was really bogus (and allocating huge amounts of memory >> unnecessarily) > > It was more wrong after your change (int -> char) but as I said I did > not see good reasons to change that now. Or is it critical and if yes > how? it is critical to my point of view :) Before my patch it would take 4 times more memory than after the patch. With larger images, it is critical :P The code can still be further optimized when using square images, but I didn't deliberately make such change in an RC phase and without your approval. I like to first see a patch for this optimization. There is many special cases or things to worry about here and BC is important. I'm not saying that an optimization is not possible or welcome, only that I like to see it prior to commit. Cheers, --Pierre -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
On 1/13/07, Nuno Lopes <[EMAIL PROTECTED]> wrote: nlopess Sat Jan 13 11:16:15 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/gd/libgd gd.c Log: fix valgrind error in test bug24594.phpt while at it, remove some dead code and change the pts vector to char to save (much) memory # Pierre: one more to merge ;) Thanks for the catch. I like to merge (and keep the fix) if I know what you are fixing. Can you send me the details please? As the commit log says, I fixed a few valgrind warnings in the bug24594.phpt test (it was reading one past the end of the array). The log is still available at http://gcov.php.net/viewer.php?version=PHP_5_2&func=valgrind&file=ext%2Fgd%2Ftests%2Fbug24594.phpt the fix is this part: - for (; x<=wx2 && (!pts[y][x] && gdImageGetPixel(im,x, y)==oc) ; x++) { + for (; x About removing the dead code, again I do not like to do it during the RC phase. Please do it __after__ 5.2.1 (take #2) if there is a very good reason to do it, but I like to keep it (as I voluntary kept it). It is really dead code and it was even marked as such. It is impossible (excluding compiler/cpu/memory/.. bugs) to reach the code I removed. If you feel scary with such trivial changes that means the extension hasn't enough tests :P (ok, kidding. that part of the code is covered) OMG, this line was really bogus (and allocating huge amounts of memory unnecessarily) It was more wrong after your change (int -> char) but as I said I did not see good reasons to change that now. Or is it critical and if yes how? it is critical to my point of view :) Before my patch it would take 4 times more memory than after the patch. With larger images, it is critical :P The code can still be further optimized when using square images, but I didn't deliberately make such change in an RC phase and without your approval. Nuno -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
Hello Nuno, On 1/13/07, Nuno Lopes <[EMAIL PROTECTED]> wrote: nlopess Sat Jan 13 11:16:15 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/gd/libgd gd.c Log: fix valgrind error in test bug24594.phpt while at it, remove some dead code and change the pts vector to char to save (much) memory # Pierre: one more to merge ;) Thanks for the catch. I like to merge (and keep the fix) if I know what you are fixing. Can you send me the details please? About removing the dead code, again I do not like to do it during the RC phase. Please do it __after__ 5.2.1 (take #2) if there is a very good reason to do it, but I like to keep it (as I voluntary kept it). --Pierre -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
nlopess Sat Jan 13 11:21:21 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/gd/libgd gd.c Log: OMG, this line was really bogus (and allocating huge amounts of memory unecessarly) http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.7&r2=1.90.2.1.2.8&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.7 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.8 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.7 Sat Jan 13 11:16:15 2007 +++ php-src/ext/gd/libgd/gd.c Sat Jan 13 11:21:21 2007 @@ -2014,7 +2014,7 @@ tiled = nc==gdTiled; nc = gdImageTileGet(im,x,y); - pts = (char **) ecalloc(sizeof(char *) * im->sy, sizeof(char)); + pts = (char **) ecalloc(im->sy, sizeof(char*)); for (i=0; isy;i++) { pts[i] = (char *) ecalloc(im->sx, sizeof(char)); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
nlopess Sat Jan 13 11:16:15 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/gd/libgd gd.c Log: fix valgrind error in test bug24594.phpt while at it, remove some dead code and change the pts vector to char to save (much) memory # Pierre: one more to merge ;) http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.6&r2=1.90.2.1.2.7&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.6 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.7 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.6 Tue Nov 14 13:45:24 2006 +++ php-src/ext/gd/libgd/gd.c Sat Jan 13 11:16:15 2007 @@ -2004,9 +2004,9 @@ /* stack of filled segments */ struct seg *stack; struct seg *sp; + char **pts; - int **pts; - if(!im->tile){ + if (!im->tile) { return; } @@ -2014,10 +2014,10 @@ tiled = nc==gdTiled; nc = gdImageTileGet(im,x,y); - pts = (int **) ecalloc(sizeof(int *) * im->sy, sizeof(int)); + pts = (char **) ecalloc(sizeof(char *) * im->sy, sizeof(char)); for (i=0; isy;i++) { - pts[i] = (int *) ecalloc(im->sx, sizeof(int)); + pts[i] = (char *) ecalloc(im->sx, sizeof(char)); } stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); @@ -2032,10 +2032,6 @@ while (sp>stack) { FILL_POP(y, x1, x2, dy); for (x=x1; x>=0 && (!pts[y][x] && gdImageGetPixel(im,x,y)==oc); x--) { - if (pts[y][x]){ - /* we should never be here */ - break; - } nc = gdImageTileGet(im,x,y); pts[y][x]=1; gdImageSetPixel(im,x, y, nc); @@ -2051,11 +2047,7 @@ } x = x1+1; do { - for (; x<=wx2 && (!pts[y][x] && gdImageGetPixel(im,x, y)==oc) ; x++) { - if (pts[y][x]){ - /* we should never be here */ - break; - } + for (; xhttp://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c
pajoye Tue Nov 14 13:45:24 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/gd/libgd gd.c Log: - #39508, do not use the 4 neighbors implementation for small images (w<4) test will follow http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.5&r2=1.90.2.1.2.6&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.5 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.6 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.5 Sat Nov 4 14:27:07 2006 +++ php-src/ext/gd/libgd/gd.c Tue Nov 14 13:45:24 2006 @@ -1931,6 +1931,29 @@ return; } + /* Do not use the 4 neighbors implementation with + * small images + */ + if (im->sx < 4) { + int ix = x, iy = y, c; + do { + c = gdImageGetPixel(im, ix, iy); + if (c != oc) { + return; + } + gdImageSetPixel(im, ix, iy, nc); + } while(ix++ < (im->sx -1)); + ix = x; iy = y + 1; + do { + c = gdImageGetPixel(im, ix, iy); + if (c != oc) { + return; + } + gdImageSetPixel(im, ix, iy, nc); + } while(ix++ < (im->sx -1)); + return; + } + stack = (struct seg *)safe_emalloc(sizeof(struct seg), ((int)(im->sy*im->sx)/4), 1); sp = stack; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c /ext/gd/tests bug39273.phpt
pajoye Sat Nov 4 02:21:06 2006 UTC Added files: (Branch: PHP_5_2) /php-src/ext/gd/tests bug39273.phpt Modified files: /php-src/ext/gd/libgd gd.c Log: - #39273, imagecopyresized and alpha channel http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.2&r2=1.90.2.1.2.3&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.2 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.3 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.2 Thu Sep 28 08:48:02 2006 +++ php-src/ext/gd/libgd/gd.c Sat Nov 4 02:21:06 2006 @@ -754,7 +754,7 @@ int p = gdImageGetPixel(im, x, y); if (!im->trueColor) { - return gdTrueColorAlpha(im->red[p], im->green[p], im->blue[p], (im->transparent == p) ? gdAlphaTransparent : gdAlphaOpaque); + return gdTrueColorAlpha(im->red[p], im->green[p], im->blue[p], (im->transparent == p) ? gdAlphaTransparent : im->alpha[p]); } else { return p; } http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/bug39273.phpt?view=markup&rev=1.1 Index: php-src/ext/gd/tests/bug39273.phpt +++ php-src/ext/gd/tests/bug39273.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c /ext/gd/tests imagefill_1.phpt
pajoye Thu Sep 28 08:48:02 2006 UTC Added files: (Branch: PHP_5_2) /php-src/ext/gd/tests imagefill_1.phpt Modified files: /php-src/ext/gd/libgd gd.c Log: - imagefill(), infinite loop with wrong color index http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.1&r2=1.90.2.1.2.2&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.1 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.2 --- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.1 Sun Jul 23 21:41:11 2006 +++ php-src/ext/gd/libgd/gd.c Thu Sep 28 08:48:02 2006 @@ -1885,6 +1885,10 @@ struct seg *stack; struct seg *sp; + if (!im->trueColor && nc > (im->colorsTotal -1)) { + return; + } + alphablending_bak = im->alphaBlendingFlag; im->alphaBlendingFlag = 0; http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/imagefill_1.phpt?view=markup&rev=1.1 Index: php-src/ext/gd/tests/imagefill_1.phpt +++ php-src/ext/gd/tests/imagefill_1.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/gd/libgd gd.c /ext/gd/tests 38179.phpt
pajoye Sun Jul 23 21:41:12 2006 UTC Added files: (Branch: PHP_5_2) /php-src/ext/gd/tests 38179.phpt Modified files: /php-src/ext/gd/libgd gd.c Log: - #38179, imagecopy, palette to truecolor must use alpha channel too http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1&r2=1.90.2.1.2.1&diff_format=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1 php-src/ext/gd/libgd/gd.c:1.90.2.1.2.1 --- php-src/ext/gd/libgd/gd.c:1.90.2.1 Fri Sep 30 20:48:05 2005 +++ php-src/ext/gd/libgd/gd.c Sun Jul 23 21:41:11 2006 @@ -2161,7 +2161,7 @@ for (x = 0; (x < w); x++) { int c = gdImageGetPixel (src, srcX + x, srcY + y); if (c != src->transparent) { - gdImageSetPixel (dst, dstX + x, dstY + y, gdTrueColor(src->red[c], src->green[c], src->blue[c])); + gdImageSetPixel(dst, dstX + x, dstY + y, gdTrueColorAlpha(src->red[c], src->green[c], src->blue[c], src->alpha[c])); } } } http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/38179.phpt?view=markup&rev=1.1 Index: php-src/ext/gd/tests/38179.phpt +++ php-src/ext/gd/tests/38179.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php