[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
iliaa Sun Mar 30 15:48:05 2003 EDT Modified files: /php4/ext/gd/libgd gd.c Log: Fixed bug #22965 (Crash in gd lib's ImageFillToBorder()). Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.48 php4/ext/gd/libgd/gd.c:1.49 --- php4/ext/gd/libgd/gd.c:1.48 Tue Mar 11 19:51:03 2003 +++ php4/ext/gd/libgd/gd.c Sun Mar 30 15:48:05 2003 @@ -1723,90 +1723,76 @@ } } -void -gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color) +void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color) { - int lastBorder; - /* Seek left */ - int leftLimit, rightLimit; - int i; - leftLimit = (-1); - if (border 0) -{ - /* Refuse to fill to a non-solid border */ - return; -} - for (i = x; (i = 0); i--) -{ - if (gdImageGetPixel (im, i, y) == border) - { - break; - } - gdImageSetPixel (im, i, y, color); - leftLimit = i; -} - if (leftLimit == (-1)) -{ - return; -} - /* Seek right */ - rightLimit = x; - for (i = (x + 1); (i im-sx); i++) -{ - if (gdImageGetPixel (im, i, y) == border) - { - break; - } - gdImageSetPixel (im, i, y, color); - rightLimit = i; -} - /* Look at lines above and below and start paints */ - /* Above */ - if (y 0) -{ - lastBorder = 1; - for (i = leftLimit; (i = rightLimit); i++) - { - int c; - c = gdImageGetPixel (im, i, y - 1); - if (lastBorder) - { - if ((c != border) (c != color)) - { - gdImageFillToBorder (im, i, y - 1, - border, color); - lastBorder = 0; + int lastBorder; + /* Seek left */ + int leftLimit = -1, rightLimit; + int i; + + if (border 0) { + /* Refuse to fill to a non-solid border */ + return; + } + + if (x = im-sx) { + x = im-sx - 1; + } + if (y = im-sy) { + y = im-sy - 1; + } + + for (i = x; i = 0; i--) { + if (gdImageGetPixel(im, i, y) == border) { + break; } - } - else if ((c == border) || (c == color)) - { - lastBorder = 1; - } - } -} - /* Below */ - if (y ((im-sy) - 1)) -{ - lastBorder = 1; - for (i = leftLimit; (i = rightLimit); i++) - { - int c; - c = gdImageGetPixel (im, i, y + 1); - if (lastBorder) - { - if ((c != border) (c != color)) - { - gdImageFillToBorder (im, i, y + 1, - border, color); - lastBorder = 0; + gdImageSetPixel(im, i, y, color); + leftLimit = i; + } + if (leftLimit == -1) { + return; + } + /* Seek right */ + rightLimit = x; + for (i = (x + 1); i im-sx; i++) { + if (gdImageGetPixel(im, i, y) == border) { + break; + } + gdImageSetPixel(im, i, y, color); + rightLimit = i; + } + /* Look at lines above and below and start paints */ + /* Above */ + if (y 0) { + lastBorder = 1; + for (i = leftLimit; i = rightLimit; i++) { + int c = gdImageGetPixel(im, i, y - 1); + if (lastBorder) { + if ((c != border) (c != color)) { + gdImageFillToBorder(im, i, y - 1, border, color); + lastBorder = 0; + } + } else if ((c == border) || (c == color)) { + lastBorder = 1; + } + } + } + /* Below */ + if (y ((im-sy) - 1)) { + lastBorder = 1; + for (i = leftLimit; i = rightLimit; i++) { + int c = gdImageGetPixel(im, i, y + 1); + + if (lastBorder) { + if ((c != border) (c != color)) { + gdImageFillToBorder(im, i, y + 1, border, color); + lastBorder = 0; + } + } else if ((c == border) || (c == color)) { + lastBorder = 1; + } } - } - else if ((c == border) || (c == color)) - { - lastBorder = 1; - } } -} } void -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c xbm.c
iliaa Tue Mar 11 19:51:03 2003 EDT Modified files: /php4/ext/gd/libgd gd.c xbm.c Log: Style fixes. Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.47 php4/ext/gd/libgd/gd.c:1.48 --- php4/ext/gd/libgd/gd.c:1.47 Mon Feb 24 22:49:26 2003 +++ php4/ext/gd/libgd/gd.c Tue Mar 11 19:51:03 2003 @@ -2857,134 +2857,6 @@ } /* End Rotate function */ -#if MBO_0 -gdImagePtr -gdImageCreateFromXbm (FILE * fd) -{ - gdImagePtr im; - int bit; - int w, h; - int bytes; - int ch; - int i, x, y; - char *sp; - char s[161]; - if (!fgets (s, 160, fd)) -{ - return 0; -} - sp = s[0]; - /* Skip #define */ - sp = strchr (sp, ' '); - if (!sp) -{ - return 0; -} - /* Skip width label */ - sp++; - sp = strchr (sp, ' '); - if (!sp) -{ - return 0; -} - /* Get width */ - w = atoi (sp + 1); - if (!w) -{ - return 0; -} - if (!fgets (s, 160, fd)) -{ - return 0; -} - sp = s; - /* Skip #define */ - sp = strchr (sp, ' '); - if (!sp) -{ - return 0; -} - /* Skip height label */ - sp++; - sp = strchr (sp, ' '); - if (!sp) -{ - return 0; -} - /* Get height */ - h = atoi (sp + 1); - if (!h) -{ - return 0; -} - /* Skip declaration line */ - if (!fgets (s, 160, fd)) -{ - return 0; -} - bytes = (w * h / 8) + 1; - im = gdImageCreate (w, h); - gdImageColorAllocate (im, 255, 255, 255); - gdImageColorAllocate (im, 0, 0, 0); - x = 0; - y = 0; - for (i = 0; (i bytes); i++) -{ - char h[3]; - unsigned int b; - /* Skip spaces, commas, CRs, 0x */ - while (1) - { - ch = getc (fd); - if (ch == EOF) - { - goto fail; - } - if (ch == 'x') - { - break; - } - } - /* Get hex value */ - ch = getc (fd); - if (ch == EOF) - { - goto fail; - } - h[0] = ch; - ch = getc (fd); - if (ch == EOF) - { - goto fail; - } - h[1] = ch; - h[2] = '\0'; - sscanf (h, %x, b); - for (bit = 1; (bit = 128); (bit = bit 1)) - { - gdImageSetPixel (im, x++, y, (b bit) ? 1 : 0); - if (x == im-sx) - { - x = 0; - y++; - if (y == im-sy) - { - return im; - } - /* Fix 8/8/95 */ - break; - } - } -} - /* Shouldn't happen */ - php_gd_error(Error: bug in gdImageCreateFromXbm\n); - return 0; -fail: - gdImageDestroy (im); - return 0; -} -#endif /* MBO_0 */ - void gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c) { Index: php4/ext/gd/libgd/xbm.c diff -u php4/ext/gd/libgd/xbm.c:1.1 php4/ext/gd/libgd/xbm.c:1.2 --- php4/ext/gd/libgd/xbm.c:1.1 Sat Feb 1 20:34:54 2003 +++ php4/ext/gd/libgd/xbm.c Tue Mar 11 19:51:03 2003 @@ -1,150 +1,153 @@ -/* - +--+ - | PHP Version 4| - +--+ - | Copyright (c) 1997-2003 The PHP Group| - +--+ - | This source file is subject to version 2.02 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is| - | available at through the world-wide-web at | - | http://www.php.net/license/2_02.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | [EMAIL PROTECTED] so we can mail you a copy immediately. | - +--+ - | Author: Marcus Boerger [EMAIL PROTECTED] | - +--+ - */ - -/* $Id: xbm.c,v 1.1 2003/02/02 01:34:54 helly Exp $ */ - -#include stdio.h -#include math.h -#include string.h -#include stdlib.h -#include gd.h -#include gdhelpers.h - -#include php.h - -#define MAX_XBM_LINE_SIZE 255 - -gdImagePtr -gdImageCreateFromXbm (FILE * fd) -{ - char fline[MAX_XBM_LINE_SIZE]; - char iname[MAX_XBM_LINE_SIZE]; - char *type; - int value; - unsigned int width = 0, height = 0; - int fail = 0; - int max_bit = 0; - - gdImagePtr im; - int bytes = 0, i; - int bit, x = 0, y = 0; - int ch; - char h[8]; - unsigned int b; - - rewind(fd); - while (fgets(fline, MAX_XBM_LINE_SIZE, fd)) { - fline[MAX_XBM_LINE_SIZE-1] = '\0'; - if (strlen(fline) == MAX_XBM_LINE_SIZE-1) { -
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
iliaa Mon Feb 24 22:49:27 2003 EDT Modified files: /php4/ext/gd/libgd gd.c Log: Fixed a crash in gdImageCopyMergeGray(). Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.46 php4/ext/gd/libgd/gd.c:1.47 --- php4/ext/gd/libgd/gd.c:1.46 Sun Feb 9 09:17:05 2003 +++ php4/ext/gd/libgd/gd.c Mon Feb 24 22:49:26 2003 @@ -2160,67 +2160,50 @@ void gdImageCopyMergeGray (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int w, int h, int pct) { + int c, dc; + int x, y; + int tox, toy; + int ncR, ncG, ncB; + float g; + toy = dstY; - int c, dc; - int x, y; - int tox, toy; - int ncR, ncG, ncB; - float g; - toy = dstY; - for (y = srcY; (y (srcY + h)); y++) -{ - tox = dstX; - for (x = srcX; (x (srcX + w)); x++) - { - int nc; - c = gdImageGetPixel (src, x, y); - /* Added 7/24/95: support transparent copies */ - if (gdImageGetTransparent (src) == c) - { - tox++; - continue; - } - /* If it's the same image, mapping is trivial */ - if (dst == src) - { - nc = c; - } - else - { - dc = gdImageGetPixel (dst, tox, toy); - g = (0.29900f * dst-red[dc]) - + (0.58700f * dst-green[dc]) - + (0.11400f * dst-blue[dc]); + for (y = srcY; (y (srcY + h)); y++) { + tox = dstX; + for (x = srcX; (x (srcX + w)); x++) { + int nc; + c = gdImageGetPixel (src, x, y); + /* Added 7/24/95: support transparent copies */ + if (gdImageGetTransparent(src) == c) { + tox++; + continue; + } + /* If it's the same image, mapping is trivial */ + if (dst == src) { + nc = c; + } else { + dc = gdImageGetPixel(dst, tox, toy); + g = (0.29900f * gdImageRed(dst, dc)) + (0.58700f * gdImageGreen(dst, dc)) + (0.11400f * gdImageBlue(dst, dc)); - ncR = (int)(gdImageRed (src, c) * (pct / 100.0f) - + gdImageRed (dst, dc) * g * - ((100 - pct) / 100.0f)); - ncG = (int)(gdImageGreen (src, c) * (pct / 100.0f) - + gdImageGreen (dst, dc) * g * - ((100 - pct) / 100.0f)); - ncB = (int)(gdImageBlue (src, c) * (pct / 100.0f) - + gdImageBlue (dst, dc) * g * - ((100 - pct) / 100.0f)); + ncR = (int)(gdImageRed (src, c) * (pct / 100.0f) + gdImageRed(dst, dc) * g * ((100 - pct) / 100.0f)); + ncG = (int)(gdImageGreen (src, c) * (pct / 100.0f) + gdImageGreen(dst, dc) * g * ((100 - pct) / 100.0f)); + ncB = (int)(gdImageBlue (src, c) * (pct / 100.0f) + gdImageBlue(dst, dc) * g * ((100 - pct) / 100.0f)); - /* First look for an exact match */ - nc = gdImageColorExact (dst, ncR, ncG, ncB); - if (nc == (-1)) - { - /* No, so try to allocate it */ - nc = gdImageColorAllocate (dst, ncR, ncG, ncB); - /* If we're out of colors, go for the -closest color */ - if (nc == (-1)) - { - nc = gdImageColorClosest (dst, ncR, ncG, ncB); - } + /* First look for an exact match */ + nc = gdImageColorExact(dst, ncR, ncG, ncB); + if (nc == (-1)) { + /* No, so try to allocate it */ + nc = gdImageColorAllocate(dst, ncR, ncG, ncB); + /* If we're out of colors, go for the closest color */ + if (nc == (-1)) { + nc = gdImageColorClosest(dst, ncR, ncG, ncB); + } + } + } + gdImageSetPixel(dst, tox, toy, nc); + tox++; } - } - gdImageSetPixel (dst, tox, toy, nc); - tox++; + toy++; } - toy++; -} } void -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
helly Sun Feb 9 09:17:05 2003 EDT Modified files: /php4/ext/gd/libgd gd.c Log: Kill some warnings # the remainig is not easy to solve: float_var = float_cast(extpression) # This cannot be fixed by simply casting again to float because some # compilers may ignore the double casting. Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.45 php4/ext/gd/libgd/gd.c:1.46 --- php4/ext/gd/libgd/gd.c:1.45 Sat Feb 8 03:41:42 2003 +++ php4/ext/gd/libgd/gd.c Sun Feb 9 09:17:05 2003 @@ -694,11 +694,11 @@ } m = (*y1 - *y0)/(double)(*x1 - *x0); /* calculate the slope of the line */ /* adjust x0 to be on the left boundary (ie to be zero), and y0 to match */ - *y0 -= m * *x0; + *y0 -= (int)(m * *x0); *x0 = 0; /* now, perhaps, adjust the far end of the line as well */ if (*x1 maxdim) { - *y1 += m * (maxdim - *x1); + *y1 += (int)(m * (maxdim - *x1)); *x1 = maxdim; } return 1; @@ -708,11 +708,11 @@ return 0; } m = (*y1 - *y0)/(double)(*x1 - *x0); /* calculate the slope of the line */ - *y0 += m * (maxdim - *x0); /* adjust so point is on the right boundary */ + *y0 += (int)(m * (maxdim - *x0)); /* adjust so point is on the right +boundary */ *x0 = maxdim; /* now, perhaps, adjust the end of the line */ if (*x1 0) { - *y1 -= m * *x1; + *y1 -= (int)(m * *x1); *x1 = 0; } return 1; @@ -720,13 +720,13 @@ /* the final case - the start of the line is inside the window */ if (*x1 maxdim) { /* other end is outside to the right */ m = (*y1 - *y0)/(double)(*x1 - *x0); /* calculate the slope of the line */ - *y1 += m * (maxdim - *x1); + *y1 += (int)(m * (maxdim - *x1)); *x1 = maxdim; return 1; } if (*x1 0) { /* other end is outside to the left */ m = (*y1 - *y0)/(double)(*x1 - *x0); /* calculate the slope of the line */ - *y1 -= m * *x1; + *y1 -= (int)(m * *x1); *x1 = 0; return 1; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c gd.h
pajoye Sat Feb 8 03:41:43 2003 EDT Modified files: /php4/ext/gd/libgd gd.c gd.h Log: Add gdImageEllipse Replace gdImageFilledEllipse by a new function (backported from the new phpgd) the new gdImageFilledEllipse fix bug bug #22103 (ellipse part) Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.44 php4/ext/gd/libgd/gd.c:1.45 --- php4/ext/gd/libgd/gd.c:1.44 Sat Feb 1 20:34:54 2003 +++ php4/ext/gd/libgd/gd.c Sat Feb 8 03:41:42 2003 @@ -1534,7 +1534,11 @@ void gdImageArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color) { - gdImageFilledArc (im, cx, cy, w, h, s, e, color, gdNoFill); + if( (s%360)==(e%360) ){ + gdImageEllipse(im, cx, cy, w, h, color); + } else { + gdImageFilledArc (im, cx, cy, w, h, s, e, color, gdNoFill); + } } void @@ -1620,10 +1624,103 @@ } } -void -gdImageFilledEllipse (gdImagePtr im, int cx, int cy, int w, int h, int color) + +/** + * Integer Ellipse functions (gdImageEllipse and gdImageFilledEllipse) + * Function added by Pierre-Alain Joye 02/08/2003 ([EMAIL PROTECTED]) + * See the ellipse function simplification for the equation + * as well as the midpoint algorithm. + */ + +void gdImageEllipse(gdImagePtr im, int mx, int my, int w, int h, int c) { - gdImageFilledArc (im, cx, cy, w, h, 0, 360, color, gdPie); + int x=0,mx1=0,mx2=0,my1=0,my2=0; + long aq,bq,dx,dy,r,rx,ry,a,b; + + a=w1; + b=h1; + gdImageSetPixel(im,mx+a, my, c); + gdImageSetPixel(im,mx-a, my, c); + mx1 = mx-a;my1 = my; + mx2 = mx+a;my2 = my; + + aq = a * a; + bq = b * b; + dx = aq 1; + dy = bq 1; + r = a * bq; + rx = r 1; + ry = 0; + x = a; + while (x 0){ + if (r 0) { + my1++;my2--; + ry +=dx; + r -=ry; + } + if (r = 0){ + x--; + mx1++;mx2--; + rx -=dy; + r +=rx; + } + gdImageSetPixel(im,mx1, my1, c); + gdImageSetPixel(im,mx1, my2, c); + gdImageSetPixel(im,mx2, my1, c); + gdImageSetPixel(im,mx2, my2, c); + } +} + +void gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c) +{ + int x=0,mx1=0,mx2=0,my1=0,my2=0; + long aq,bq,dx,dy,r,rx,ry,a,b; + int i; + int old_y1,old_y2; + + a=w1; + b=h1; + + gdImageLine(im, mx-a, my, mx+a, my, c); + + mx1 = mx-a;my1 = my; + mx2 = mx+a;my2 = my; + + aq = a * a; + bq = b * b; + dx = aq 1; + dy = bq 1; + r = a * bq; + rx = r 1; + ry = 0; + x = a; + old_y2=-1; + old_y1=-1; + while (x 0){ + if (r 0) { + my1++;my2--; + ry +=dx; + r -=ry; + } + if (r = 0){ + x--; + mx1++;mx2--; + rx -=dy; + r +=rx; + } + if(old_y2!=my2){ + for(i=mx1;i=mx2;i++){ + gdImageSetPixel(im,i,my1,c); + } + } + if(old_y2!=my2){ + for(i=mx1;i=mx2;i++){ + gdImageSetPixel(im,i,my2,c); + } + } + old_y2 = my2; + old_y1 = my1; + } } void Index: php4/ext/gd/libgd/gd.h diff -u php4/ext/gd/libgd/gd.h:1.14 php4/ext/gd/libgd/gd.h:1.15 --- php4/ext/gd/libgd/gd.h:1.14 Fri Jan 17 13:34:07 2003 +++ php4/ext/gd/libgd/gd.h Sat Feb 8 03:41:43 2003 @@ -420,7 +420,7 @@ /* Best to free this memory with gdFree(), not free() */ void* gdImageGd2Ptr(gdImagePtr im, int cs, int fmt, int *size); -void gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int color); +void gdImageEllipse(gdImagePtr im, int cx, int cy, int w, int h, int c); /* Style is a bitwise OR ( | operator ) of these. gdArc and gdChord are mutually exclusive; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
pajoye Mon Jan 20 20:49:34 2003 EDT Modified files: /php4/ext/gd/libgd gd.c Log: Add credits to my functions (thx for the advice WezIlia :) Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.41 php4/ext/gd/libgd/gd.c:1.42 --- php4/ext/gd/libgd/gd.c:1.41 Fri Jan 17 13:34:07 2003 +++ php4/ext/gd/libgd/gd.c Mon Jan 20 20:49:34 2003 @@ -1077,6 +1077,11 @@ } } + +/* + * Added on 2003/12 by Pierre-Alain Joye ([EMAIL PROTECTED]) + * (c) 2003 Pierre-Alain Joye + * */ #define BLEND_COLOR(a, nc, c, cc) \ nc = (cc) + (c) - (cc)) * (a)) + c) - (cc)) * (a)) 8) + 0x80) 8); @@ -1098,6 +1103,10 @@ im-tpixels[y][x]=gdTrueColorAlpha(dr, dg, db, gdAlphaOpaque); } +/* + * Added on 2003/12 by Pierre-Alain Joye ([EMAIL PROTECTED]) + * (c) 2003 Pierre-Alain Joye + **/ void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col) { /* keep them as 32bits */ @@ -2331,6 +2340,13 @@ } } + +/* + * Rotate function Added on 2003/12 + * by Pierre-Alain Joye ([EMAIL PROTECTED]) + * (c) 2003 Pierre-Alain Joye + **/ +/* Begin rotate function */ #ifdef ROTATE_PI #undef ROTATE_PI #endif /* ROTATE_PI */ @@ -2762,6 +2778,7 @@ return rotatedImg; } +/* End Rotate function */ gdImagePtr gdImageCreateFromXbm (FILE * fd) @@ -3293,6 +3310,12 @@ } } + +/* Filters function added on 2003/12 + * by Pierre-Alain Joye ([EMAIL PROTECTED]) + * (c) 2003 Pierre-Alain Joye + **/ +/* Begin filters function */ #ifndef HAVE_GET_TRUE_COLOR #define GET_PIXEL_FUNCTION(src)(src-trueColor?gdImageGetTrueColorPixel:gdImageGetPixel) #endif @@ -3745,3 +3768,4 @@ return gdImageConvolution(im, filter, weight+8, 0); } +/* End filters function */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
pajoye Mon Jan 20 21:10:20 2003 EDT Modified files: /php4/ext/gd/libgd gd.c Log: Remove the (c), in the future, can we add PHP Licence terms for the new functions ? Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.42 php4/ext/gd/libgd/gd.c:1.43 --- php4/ext/gd/libgd/gd.c:1.42 Mon Jan 20 20:49:34 2003 +++ php4/ext/gd/libgd/gd.c Mon Jan 20 21:10:19 2003 @@ -1080,7 +1080,6 @@ /* * Added on 2003/12 by Pierre-Alain Joye ([EMAIL PROTECTED]) - * (c) 2003 Pierre-Alain Joye * */ #define BLEND_COLOR(a, nc, c, cc) \ nc = (cc) + (c) - (cc)) * (a)) + c) - (cc)) * (a)) 8) + 0x80) 8); @@ -1105,7 +1104,6 @@ /* * Added on 2003/12 by Pierre-Alain Joye ([EMAIL PROTECTED]) - * (c) 2003 Pierre-Alain Joye **/ void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col) { @@ -2344,7 +2342,6 @@ /* * Rotate function Added on 2003/12 * by Pierre-Alain Joye ([EMAIL PROTECTED]) - * (c) 2003 Pierre-Alain Joye **/ /* Begin rotate function */ #ifdef ROTATE_PI @@ -3313,7 +3310,6 @@ /* Filters function added on 2003/12 * by Pierre-Alain Joye ([EMAIL PROTECTED]) - * (c) 2003 Pierre-Alain Joye **/ /* Begin filters function */ #ifndef HAVE_GET_TRUE_COLOR -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
iliaa Thu Jan 9 21:00:41 2003 EDT Modified files: /php4/ext/gd/libgd gd.c Log: Fixed ImageRotate when rotation angle is 90 degrees, patch by [EMAIL PROTECTED] Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.39 php4/ext/gd/libgd/gd.c:1.40 --- php4/ext/gd/libgd/gd.c:1.39 Wed Dec 18 16:13:21 2002 +++ php4/ext/gd/libgd/gd.c Thu Jan 9 21:00:39 2003 @@ -2492,10 +2492,10 @@ FuncPtr f; if (src-trueColor) { - dst = gdImageCreateTrueColor ( src-sx,src-sy); + dst = gdImageCreateTrueColor(src-sy, src-sx); f = gdImageGetTrueColorPixel; } else { - dst = gdImageCreate (src-sx, src-sy); + dst = gdImageCreate (src-sy, src-sx); f = gdImageGetPixel; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
pajoye Sat Dec 14 14:23:29 2002 EDT Modified files: /php4/ext/gd/libgd gd.c Log: Do not allow AA if not trueColor (imageantialias does nothing) Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.36 php4/ext/gd/libgd/gd.c:1.37 --- php4/ext/gd/libgd/gd.c:1.36 Wed Dec 11 17:23:51 2002 +++ php4/ext/gd/libgd/gd.c Sat Dec 14 14:23:29 2002 @@ -3189,7 +3189,9 @@ void gdImageAntialias (gdImagePtr im, int antialias) { - im-antialias = antialias; + if (im-trueColor){ + im-antialias = antialias; + } } void -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
pajoye Wed Dec 11 15:46:52 2002 EDT Modified files: /php4/ext/gd/libgd gd.c Log: Add gdImageAAline (antialiased line) Add AA support for gdImagePolygon Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.32 php4/ext/gd/libgd/gd.c:1.33 --- php4/ext/gd/libgd/gd.c:1.32 Sun Dec 8 16:07:13 2002 +++ php4/ext/gd/libgd/gd.c Wed Dec 11 15:46:52 2002 @@ -1037,6 +1037,134 @@ } } } + + +#define BLEND_COLOR(a, nc, c, cc) \ +nc = (cc) + (c) - (cc)) * (a)) + c) - (cc)) * (a)) 8) + 0x80) 8); + +inline static void gdImageSetAAPixelColor(gdImagePtr im, int x, int y, int color, int +t) +{ + int dr,dg,db,p,r,g,b; + dr = gdTrueColorGetRed(color); + dg = gdTrueColorGetGreen(color); + db = gdTrueColorGetBlue(color); + + p = gdImageGetPixel(im,x,y); + r = gdTrueColorGetRed(p); + g = gdTrueColorGetGreen(p); + b = gdTrueColorGetBlue(p); + + BLEND_COLOR(t, dr, r, dr); + BLEND_COLOR(t, dg, g, dg); + BLEND_COLOR(t, db, b, db); + im-tpixels[y][x]=gdTrueColorAlpha(dr, dg, db, gdAlphaOpaque); +} + +void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col) +{ +/* keep them as 32bits */ +long x, y, inc; + long dx, dy,tmp; + + if (y1 0 y2 0) { + return; + } + if (y1 0) { + x1 += (y1 * (x1 - x2)) / (y2 - y1); + y1 = 0; + } + if (y2 0) { + x2 += (y2 * (x1 - x2)) / (y2 - y1); + y2 = 0; + } + + /* bottom edge */ + if (y1 = im-sy y2 = im-sy) { + return; + } + if (y1 = im-sy) { + x1 -= ((im-sy - y1) * (x1 - x2)) / (y2 - y1); + y1 = im-sy - 1; + } + if (y2 = im-sy) { + x2 -= ((im-sy - y2) * (x1 - x2)) / (y2 - y1); + y2 = im-sy - 1; + } + + /* left edge */ + if (x1 0 x2 0) { + return; + } + if (x1 0) { + y1 += (x1 * (y1 - y2)) / (x2 - x1); + x1 = 0; + } + if (x2 0) { + y2 += (x2 * (y1 - y2)) / (x2 - x1); + x2 = 0; + } + /* right edge */ + if (x1 = im-sx x2 = im-sx) { + return; + } + if (x1 = im-sx) { + y1 -= ((im-sx - x1) * (y1 - y2)) / (x2 - x1); + x1 = im-sx - 1; + } + if (x2 = im-sx) { + y2 -= ((im-sx - x2) * (y1 - y2)) / (x2 - x1); + x2 = im-sx - 1; + } + + dx = x2 - x1; + dy = y2 - y1; + + if (dx == 0 dy == 0) { + return; + } + if (abs(dx) abs(dy)) { + if (dx 0) { + tmp = x1; + x1 = x2; + x2 = tmp; + tmp = y1; + y1 = y2; + y2 = tmp; + dx = x2 - x1; + dy = y2 - y1; + } + x = x1 16; + y = y1 16; + inc = (dy * 65536) / dx; + while ((x 16) x2) { + gdImageSetAAPixelColor(im, x 16, y 16, col, (y 8) +0xFF); + gdImageSetAAPixelColor(im, x 16, (y 16) + 1,col, (~y +8) 0xFF); + x += (1 16); + y += inc; + } + } else { + if (dy 0) { + tmp = x1; + x1 = x2; + x2 = tmp; + tmp = y1; + y1 = y2; + y2 = tmp; + dx = x2 - x1; + dy = y2 - y1; + } + x = x1 16; + y = y1 16; + inc = (dx * 65536) / dy; + while ((y16) y2) { + gdImageSetAAPixelColor(im, x 16, y 16, col, (x 8) +0xFF); + gdImageSetAAPixelColor(im, (x 16) + 1, (y 16),col, (~x + 8) 0xFF); + x += inc; + y += (116); + } + } +} + static void dashedSet (gdImagePtr im, int x, int y, int color, int *onP, int *dashStepP, int wid, int vert); @@ -2776,22 +2904,28 @@ void gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c) { - int i; - int lx, ly; - if (!n) -{ - return; -} - lx = p-x; - ly = p-y; - gdImageLine (im, lx, ly, p[n - 1].x, p[n - 1].y, c); - for (i = 1; (i n); i++) -{ - p++; - gdImageLine (im, lx, ly, p-x, p-y, c); - lx = p-x; - ly = p-y; -} + int i; + int lx, ly; + typedef void (*image_line)(gdImagePtr im, int x1, int y1, int x2, int y2, int +color); + image_line draw_line; + + if (!n) { + return; + } + if ( im-antialias) { + draw_line =
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
iliaa Wed Dec 11 16:52:30 2002 EDT Modified files: /php4/ext/gd/libgd gd.c Log: Syncronize bundled gd sources with that of gd 2.0.9, affected functions are: gdImageBrushApply() gdImageCopyResized(). Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.33 php4/ext/gd/libgd/gd.c:1.34 --- php4/ext/gd/libgd/gd.c:1.33 Wed Dec 11 15:46:52 2002 +++ php4/ext/gd/libgd/gd.c Wed Dec 11 16:52:29 2002 @@ -750,74 +750,60 @@ static void gdImageBrushApply (gdImagePtr im, int x, int y) { - int lx, ly; - int hy; - int hx; - int x1, y1, x2, y2; - int srcx, srcy; - if (!im-brush) -{ - return; -} - hy = gdImageSY (im-brush) / 2; - y1 = y - hy; - y2 = y1 + gdImageSY (im-brush); - hx = gdImageSX (im-brush) / 2; - x1 = x - hx; - x2 = x1 + gdImageSX (im-brush); - srcy = 0; - if (im-trueColor) -{ - for (ly = y1; (ly y2); ly++) - { - srcx = 0; - for (lx = x1; (lx x2); lx++) - { - int p; - p = gdImageGetTrueColorPixel ( -im-brush, srcx, srcy); - gdImageSetPixel (im, lx, ly, - p); - srcx++; - } - srcy++; + int lx, ly; + int hy, hx; + int x1, y1, x2, y2; + int srcx, srcy; + + if (!im-brush) { + return; } -} - else -{ - for (ly = y1; (ly y2); ly++) - { - srcx = 0; - for (lx = x1; (lx x2); lx++) - { - int p; - p = gdImageGetPixel (im-brush, srcx, srcy); - /* Allow for non-square brushes! */ - if (p != gdImageGetTransparent (im-brush)) - { - /* Truecolor brush. Very slow -on a palette destination. */ - if (im-brush-trueColor) - { - gdImageSetPixel (im, lx, ly, - gdImageColorResolveAlpha ( - im, - gdTrueColorGetRed (p), - gdTrueColorGetGreen (p), -gdTrueColorGetBlue (p), - gdTrueColorGetAlpha (p))); - } - else - { - gdImageSetPixel (im, lx, ly, - im-brushColorMap[p]); - } + + hy = gdImageSY (im-brush) / 2; + y1 = y - hy; + y2 = y1 + gdImageSY (im-brush); + hx = gdImageSX (im-brush) / 2; + x1 = x - hx; + x2 = x1 + gdImageSX (im-brush); + srcy = 0; + + if (im-trueColor) { + for (ly = y1; (ly y2); ly++) { + srcx = 0; + for (lx = x1; (lx x2); lx++) { + int p; + p = gdImageGetTrueColorPixel (im-brush, srcx, srcy); + /* 2.0.9, Thomas Winzig: apply simple full +transparency */ + if (p != gdImageGetTransparent (im-brush)) { + gdImageSetPixel (im, lx, ly, p); + } + srcx++; + } + srcy++; + } + } else { + for (ly = y1; (ly y2); ly++) { + srcx = 0; + for (lx = x1; (lx x2); lx++) { + int p; + p = gdImageGetPixel (im-brush, srcx, srcy); + /* Allow for non-square brushes! */ + if (p != gdImageGetTransparent (im-brush)) { + /* Truecolor brush. Very slow on a palette +destination. */ + if (im-brush-trueColor) { + gdImageSetPixel(im, lx, ly, +gdImageColorResolveAlpha(im, gdTrueColorGetRed(p), + + gdTrueColorGetGreen(p), + + gdTrueColorGetBlue(p), + + gdTrueColorGetAlpha(p))); + } else { + gdImageSetPixel(im, lx, ly, +im-brushColorMap[p]); + } + } + srcx++; + } + srcy++; } -
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
iliaa Wed Dec 11 16:55:45 2002 EDT Modified files: /php4/ext/gd/libgd gd.c Log: White space fixes. Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.34 php4/ext/gd/libgd/gd.c:1.35 --- php4/ext/gd/libgd/gd.c:1.34 Wed Dec 11 16:52:29 2002 +++ php4/ext/gd/libgd/gd.c Wed Dec 11 16:55:45 2002 @@ -1048,20 +1048,20 @@ void gdImageAALine (gdImagePtr im, int x1, int y1, int x2, int y2, int col) { -/* keep them as 32bits */ -long x, y, inc; + /* keep them as 32bits */ + long x, y, inc; long dx, dy,tmp; if (y1 0 y2 0) { return; } if (y1 0) { - x1 += (y1 * (x1 - x2)) / (y2 - y1); + x1 += (y1 * (x1 - x2)) / (y2 - y1); y1 = 0; } if (y2 0) { x2 += (y2 * (x1 - x2)) / (y2 - y1); - y2 = 0; + y2 = 0; } /* bottom edge */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
pajoye Wed Dec 11 17:23:51 2002 EDT Modified files: /php4/ext/gd/libgd gd.c Log: Fix brightness filter (argument ingnored) Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.35 php4/ext/gd/libgd/gd.c:1.36 --- php4/ext/gd/libgd/gd.c:1.35 Wed Dec 11 16:55:45 2002 +++ php4/ext/gd/libgd/gd.c Wed Dec 11 17:23:51 2002 @@ -3410,7 +3410,7 @@ return 0; } - contrast = (double)(100.0-80.0)/100.0; + contrast = (double)(100.0-contrast)/100.0; contrast = contrast*contrast; for (y=0; ysrc-sy; ++y) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
iliaa Sun Dec 8 16:07:13 2002 EDT Modified files: /php4/ext/gd/libgd gd.c Log: Fixed a color mixup in gdImageCopyResampled() when dealing with true-color images brought the code up to PHP coding standards. Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.31 php4/ext/gd/libgd/gd.c:1.32 --- php4/ext/gd/libgd/gd.c:1.31 Sun Dec 1 06:43:54 2002 +++ php4/ext/gd/libgd/gd.c Sun Dec 8 16:07:13 2002 @@ -2113,142 +2113,106 @@ arithmetic. The routine below is shamelessly, gloriously floating point. TBB */ -void -gdImageCopyResampled (gdImagePtr dst, - gdImagePtr src, - int dstX, int dstY, - int srcX, int srcY, - int dstW, int dstH, - int srcW, int srcH) +void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int +srcX, int srcY, int dstW, int dstH, int srcW, int srcH) { - int x, y; - if (!dst-trueColor) -{ - gdImageCopyResized ( - dst, src, dstX, dstY, srcX, srcY, dstW, dstH, - srcW, srcH); - return; -} - for (y = dstY; (y dstY + dstH); y++) -{ - for (x = dstX; (x dstX + dstW); x++) - { - float sy1, sy2, sx1, sx2; - float sx, sy; - float spixels = 0; - float red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0, alpha_sum = 0.0, contrib_sum = 0.0, alpha_factor; - sy1 = ((float) y - (float) dstY) * (float) srcH / - (float) dstH; - sy2 = ((float) (y + 1) - (float) dstY) * (float) srcH / - (float) dstH; - sy = sy1; - do - { - float yportion; - if (floorf (sy) == floorf (sy1)) - { - yportion = 1.0f - (sy - floorf (sy)); - if (yportion sy2 - sy1) - { - yportion = sy2 - sy1; - } - sy = floorf (sy); - } - else if (sy == floorf (sy2)) - { - yportion = sy2 - floorf (sy2); - } - else - { - yportion = 1.0f; - } - sx1 = ((float) x - (float) dstX) * (float) srcW / - dstW; - sx2 = ((float) (x + 1) - (float) dstX) * (float) srcW / - dstW; - sx = sx1; - do - { - float xportion; - float pcontribution; - int p; - if (floorf (sx) == floorf (sx1)) - { - xportion = 1.0f - (sx - floorf (sx)); - if (xportion sx2 - sx1) - { - xportion = sx2 - sx1; - } - sx = floorf (sx); - } - else if (sx == floorf (sx2)) - { - xportion = sx2 - floorf (sx2); - } - else - { - xportion = 1.0f; - } - pcontribution = xportion * yportion; - p = gdImageGetTrueColorPixel ( -src, -(int) sx, -(int) sy); - alpha_factor = ((gdAlphaMax - gdTrueColorGetAlpha(p))) * pcontribution; - green += gdTrueColorGetGreen (p) * pcontribution; - red += gdTrueColorGetRed (p) * alpha_factor; - blue += gdTrueColorGetBlue (p) * pcontribution; - green += gdTrueColorGetGreen (p) * alpha_factor; - alpha += gdTrueColorGetAlpha (p) * pcontribution; - alpha_sum += alpha_factor; - contrib_sum += pcontribution; - spixels += xportion * yportion; - sx += 1.0; + int x, y; + if (!dst-trueColor) { + gdImageCopyResized (dst, src, dstX, dstY, srcX, srcY, dstW, dstH, +srcW, srcH); + return; + } + for (y = dstY; (y dstY + dstH); y++) { + for (x = dstX; (x dstX + dstW); x++) { + float sy1, sy2, sx1, sx2; + float sx, sy; + float spixels = 0.0; + float red = 0.0, green = 0.0, blue = 0.0, alpha = 0.0; + float alpha_factor, alpha_sum = 0.0, contrib_sum = 0.0; + sy1 = ((float)(y - dstY)) * (float)srcH / (float)dstH; + sy2 = ((float)(y + 1 - dstY)) * (float) srcH / (float) dstH; + sy = sy1; + do { + float
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c gd.h gd_arc_f_buggy.c gd_gd2.c gd_gif_in.c gd_jpeg.c gd_png.c gd_ss.c gd_wbmp.c gdkanji.c gdxpm.c
helly Sun Dec 1 06:43:55 2002 EDT Modified files: /php4/ext/gd/libgd gd.c gd.h gd_arc_f_buggy.c gd_gd2.c gd_gif_in.c gd_jpeg.c gd_png.c gd_ss.c gd_wbmp.c gdkanji.c gdxpm.c Log: No more (f)printf for errors and warnings instead use php_error_docref. Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.30 php4/ext/gd/libgd/gd.c:1.31 --- php4/ext/gd/libgd/gd.c:1.30 Thu Nov 28 20:44:19 2002 +++ php4/ext/gd/libgd/gd.c Sun Dec 1 06:43:54 2002 @@ -92,6 +92,28 @@ static int gdAlphaOverlayColor(int src, int dst, int max); static int gdImageGetTrueColorPixel(gdImagePtr im, int x, int y); +void php_gd_error_ex(int type, const char *format, ...) +{ + va_list args; + + TSRMLS_FETCH(); + + va_start(args, format); + php_verror(NULL, , type, format, args TSRMLS_CC); + va_end(args); +} + +void php_gd_error(const char *format, ...) +{ + va_list args; + + TSRMLS_FETCH(); + + va_start(args, format); + php_verror(NULL, , E_WARNING, format, args TSRMLS_CC); + va_end(args); +} + gdImagePtr gdImageCreate (int sx, int sy) { @@ -2780,7 +2802,7 @@ } } /* Shouldn't happen */ - fprintf (stderr, Error: bug in gdImageCreateFromXbm!\n); + php_gd_error(Error: bug in gdImageCreateFromXbm\n); return 0; fail: gdImageDestroy (im); Index: php4/ext/gd/libgd/gd.h diff -u php4/ext/gd/libgd/gd.h:1.9 php4/ext/gd/libgd/gd.h:1.10 --- php4/ext/gd/libgd/gd.h:1.9 Sun Nov 24 20:51:53 2002 +++ php4/ext/gd/libgd/gd.h Sun Dec 1 06:43:54 2002 @@ -30,6 +30,11 @@ #include stdio.h #include gd_io.h +void php_gd_error_ex(int type, const char *format, ...); + +void php_gd_error(const char *format, ...); + + /* The maximum number of palette entries in palette-based images. In the wonderful new world of gd 2.0, you can of course have many more colors when using truecolor mode. */ Index: php4/ext/gd/libgd/gd_arc_f_buggy.c diff -u php4/ext/gd/libgd/gd_arc_f_buggy.c:1.1 php4/ext/gd/libgd/gd_arc_f_buggy.c:1.2 --- php4/ext/gd/libgd/gd_arc_f_buggy.c:1.1 Fri Apr 12 22:03:08 2002 +++ php4/ext/gd/libgd/gd_arc_f_buggy.c Sun Dec 1 06:43:54 2002 @@ -726,12 +726,12 @@ out = fopen (test/arctest.png, wb); if (!out) { - fprintf (stderr, Can't create test/arctest.png\n); + php_gd_error(Can't create test/arctest.png\n); exit (1); } gdImagePng (im, out); fclose (out); - fprintf (stderr, Test image written to test/arctest.png\n); + php_gd_error(Test image written to test/arctest.png\n); /* Destroy it */ gdImageDestroy (im); Index: php4/ext/gd/libgd/gd_gd2.c diff -u php4/ext/gd/libgd/gd_gd2.c:1.7 php4/ext/gd/libgd/gd_gd2.c:1.8 --- php4/ext/gd/libgd/gd_gd2.c:1.7 Thu Nov 28 17:48:19 2002 +++ php4/ext/gd/libgd/gd_gd2.c Sun Dec 1 06:43:54 2002 @@ -25,8 +25,8 @@ /* Use this for commenting out debug-print statements. */ /* Just use the first '#define' to allow all the prints... */ -/*#define GD2_DBG(s) (s) */ -#define GD2_DBG(s) +#define GD2_DBG(s) (s) +//#define GD2_DBG(s) typedef struct { @@ -53,7 +53,7 @@ int sidx; int nc; - GD2_DBG (printf (Reading gd2 header info\n)); + GD2_DBG(php_gd_error(Reading gd2 header info\n)); for (i = 0; i 4; i++) { @@ -66,12 +66,12 @@ }; id[4] = 0; - GD2_DBG (printf (Got file code: %s\n, id)); + GD2_DBG(php_gd_error(Got file code: %s\n, id)); /* Equiv. of 'magick'. */ if (strcmp (id, GD2_ID) != 0) { - GD2_DBG (printf (Not a valid gd2 file\n)); + GD2_DBG(php_gd_error(Not a valid gd2 file\n)); goto fail1; }; @@ -80,37 +80,37 @@ { goto fail1; }; - GD2_DBG (printf (Version: %d\n, *vers)); + GD2_DBG(php_gd_error(Version: %d\n, *vers)); if ((*vers != 1) (*vers != 2)) { - GD2_DBG (printf (Bad version: %d\n, *vers)); + GD2_DBG(php_gd_error(Bad version: %d\n, *vers)); goto fail1; }; /* Image Size */ if (!gdGetWord (sx, in)) { - GD2_DBG (printf (Could not get x-size\n)); + GD2_DBG(php_gd_error(Could not get x-size\n)); goto fail1; } if (!gdGetWord (sy, in)) { - GD2_DBG (printf (Could not get y-size\n)); + GD2_DBG(php_gd_error(Could not get y-size\n)); goto fail1; } - GD2_DBG (printf (Image is %dx%d\n, *sx, *sy)); + GD2_DBG(php_gd_error(Image is %dx%d\n, *sx, *sy)); /* Chunk Size (pixels, not bytes!) */ if (gdGetWord (cs, in) != 1) { goto fail1; }; - GD2_DBG (printf (ChunkSize: %d\n, *cs)); + GD2_DBG(php_gd_error(ChunkSize: %d\n, *cs)); if ((*cs GD2_CHUNKSIZE_MIN) || (*cs GD2_CHUNKSIZE_MAX)) { - GD2_DBG (printf (Bad chunk size: %d\n, *cs)); + GD2_DBG(php_gd_error(Bad chunk size: %d\n, *cs)); goto fail1; }; @@ -119,11 +119,11 @@ { goto fail1; }; - GD2_DBG (printf (Format: %d\n,
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c gd_jpeg.c gdft.c
helly Thu Nov 28 20:44:19 2002 EDT Modified files: /php4/ext/gd/libgd gd.c gd_jpeg.c gdft.c Log: Conversion fixes Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.29 php4/ext/gd/libgd/gd.c:1.30 --- php4/ext/gd/libgd/gd.c:1.29 Thu Nov 28 17:48:19 2002 +++ php4/ext/gd/libgd/gd.c Thu Nov 28 20:44:19 2002 @@ -1092,7 +1092,7 @@ else { /* More-or-less vertical. use wid for horizontal stroke */ - wid = thick * sin (atan2 (dy, dx)); + wid = (int)(thick * sin (atan2 (dy, dx))); vert = 0; d = 2 * dx - dy; Index: php4/ext/gd/libgd/gd_jpeg.c diff -u php4/ext/gd/libgd/gd_jpeg.c:1.7 php4/ext/gd/libgd/gd_jpeg.c:1.8 --- php4/ext/gd/libgd/gd_jpeg.c:1.7 Thu Nov 28 17:48:19 2002 +++ php4/ext/gd/libgd/gd_jpeg.c Thu Nov 28 20:44:19 2002 @@ -812,7 +812,7 @@ /* Write any data remaining in the buffer */ if (datacount 0) { - if (gdPutBuf (dest-buffer, datacount, dest-outfile) != datacount) + if ((size_t)gdPutBuf (dest-buffer, datacount, dest-outfile) != datacount) ERREXIT (cinfo, JERR_FILE_WRITE); } } Index: php4/ext/gd/libgd/gdft.c diff -u php4/ext/gd/libgd/gdft.c:1.16 php4/ext/gd/libgd/gdft.c:1.17 --- php4/ext/gd/libgd/gdft.c:1.16 Sun Nov 24 20:51:53 2002 +++ php4/ext/gd/libgd/gdft.cThu Nov 28 20:44:19 2002 @@ -26,6 +26,10 @@ #endif /* number of antialised colors for indexed bitmaps */ +/* overwrite Windows GDI define in case of windows build */ +#ifdef NUMCOLORS +#undef NUMCOLORS +#endif #define NUMCOLORS 8 char * @@ -880,8 +884,8 @@ if (ch == '\r') { penf.x = 0; - x1 = (penf.x * cos_a - penf.y * sin_a + 32) / 64; - y1 = (penf.x * sin_a + penf.y * cos_a + 32) / 64; + x1 = (int)(penf.x * cos_a - penf.y * sin_a + 32) / 64; + y1 = (int)(penf.x * sin_a + penf.y * cos_a + 32) / 64; pen.x = pen.y = 0; previous = 0; /* clear kerning flag */ next++; @@ -890,10 +894,10 @@ /* newlines */ if (ch == '\n') { - penf.y -= face-size-metrics.height * linespace; + penf.y -= (long)(face-size-metrics.height * linespace); penf.y = (penf.y - 32) -64; /* round to next pixel row */ - x1 = (penf.x * cos_a - penf.y * sin_a + 32) / 64; - y1 = (penf.x * sin_a + penf.y * cos_a + 32) / 64; + x1 = (int)(penf.x * cos_a - penf.y * sin_a + 32) / 64; + y1 = (int)(penf.x * sin_a + penf.y * cos_a + 32) / 64; pen.x = pen.y = 0; previous = 0; /* clear kerning flag */ next++; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
derick Sun Nov 17 09:25:50 2002 EDT Modified files: /php4/ext/gd/libgd gd.c Log: - Fix compile problems for mips pro Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.26 php4/ext/gd/libgd/gd.c:1.27 --- php4/ext/gd/libgd/gd.c:1.26 Thu Nov 14 10:08:39 2002 +++ php4/ext/gd/libgd/gd.c Sun Nov 17 09:25:50 2002 @@ -3597,8 +3597,10 @@ int gdImageSmooth(gdImagePtr im, float weight) { float filter[3][3] ={{1.0,1.0,1.0}, - {1.0,weight ,1.0}, + {1.0,0.0,1.0}, {1.0,1.0,1.0}}; + + filter[1][1] = weight; return gdImageConvolution(im, filter, weight+8, 0); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
helly Thu Nov 14 10:08:40 2002 EDT Modified files: /php4/ext/gd/libgd gd.c Log: Fix warnings (Marcus Pierre-Alain Joye) Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.25 php4/ext/gd/libgd/gd.c:1.26 --- php4/ext/gd/libgd/gd.c:1.25 Wed Nov 13 15:02:58 2002 +++ php4/ext/gd/libgd/gd.c Thu Nov 14 10:08:39 2002 -2215,7 +2215,7 int i, r, g, b, a; FuncPtr f; - int pxlOldLeft, pxlLeft, pxlSrc; + int pxlOldLeft, pxlLeft=0, pxlSrc; if (src-trueColor) { f = gdImageGetTrueColorPixel; -2301,7 +2301,7 typedef int (*FuncPtr)(gdImagePtr, int, int); int i, iYPos=0, r, g, b, a; FuncPtr f; - int pxlOldLeft, pxlLeft, pxlSrc; + int pxlOldLeft, pxlLeft=0, pxlSrc; if (src-trueColor) { f = gdImageGetTrueColorPixel; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
I always compile with all warnings enabled and fix warnings for linux and windows builds. I am mostly using gcc -Wall -Wconversion -ggdb [marcuszaphod PHP_4_3_0]$ gcc -v Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/specs gcc version 2.96 2731 (Mandrake Linux 8.2 2.96-0.76mdk) Sometimes i use a sun as well but i am not fixing warnings for that target. The warning was about pxlLeft propably not bein initialised. This could not happen if every thing is ok. If not Setting it to 0 should result in something debugable. Or do you mean the other fix for the TSRM stuff? marcus At 16:27 14.11.2002, Ilia A. wrote: Which compiler are you using and with which options that gave you warning(s) on these lines? Ilia On November 14, 2002 10:08 am, Marcus Boerger wrote: helly Thu Nov 14 10:08:40 2002 EDT Modified files: /php4/ext/gd/libgdgd.c Log: Fix warnings (Marcus Pierre-Alain Joye) Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.25 php4/ext/gd/libgd/gd.c:1.26 --- php4/ext/gd/libgd/gd.c:1.25 Wed Nov 13 15:02:58 2002 +++ php4/ext/gd/libgd/gd.cThu Nov 14 10:08:39 2002 -2215,7 +2215,7 int i, r, g, b, a; FuncPtr f; - int pxlOldLeft, pxlLeft, pxlSrc; + int pxlOldLeft, pxlLeft=0, pxlSrc; if (src-trueColor) { f = gdImageGetTrueColorPixel; -2301,7 +2301,7 typedef int (*FuncPtr)(gdImagePtr, int, int); int i, iYPos=0, r, g, b, a; FuncPtr f; - int pxlOldLeft, pxlLeft, pxlSrc; + int pxlOldLeft, pxlLeft=0, pxlSrc; if (src-trueColor) { f = gdImageGetTrueColorPixel; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
On November 14, 2002 10:45 am, Marcus Börger wrote: I always compile with all warnings enabled and fix warnings for linux and windows builds. I am mostly using gcc -Wall -Wconversion -ggdb Thanks, I'll add -Wconversion to my CFLAGS. [marcuszaphod PHP_4_3_0]$ gcc -v Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/specs gcc version 2.96 2731 (Mandrake Linux 8.2 2.96-0.76mdk) Sometimes i use a sun as well but i am not fixing warnings for that target. The warning was about pxlLeft propably not bein initialised. This could not happen if every thing is ok. If not Setting it to 0 should result in something debugable. I've tried the fix on the regular gcc 2.95.3 and gcc 3.2 (Sun OS) both did not complain with the regular -Wall -g3 flags. Or do you mean the other fix for the TSRM stuff? My mistake, I usually don't compile with TSRM since some modules do not compile when I use experimental-zts. Ilia marcus At 16:27 14.11.2002, Ilia A. wrote: Which compiler are you using and with which options that gave you warning(s) on these lines? Ilia On November 14, 2002 10:08 am, Marcus Boerger wrote: helly Thu Nov 14 10:08:40 2002 EDT Modified files: /php4/ext/gd/libgdgd.c Log: Fix warnings (Marcus Pierre-Alain Joye) Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.25 php4/ext/gd/libgd/gd.c:1.26 --- php4/ext/gd/libgd/gd.c:1.25 Wed Nov 13 15:02:58 2002 +++ php4/ext/gd/libgd/gd.cThu Nov 14 10:08:39 2002 -2215,7 +2215,7 int i, r, g, b, a; FuncPtr f; - int pxlOldLeft, pxlLeft, pxlSrc; + int pxlOldLeft, pxlLeft=0, pxlSrc; if (src-trueColor) { f = gdImageGetTrueColorPixel; -2301,7 +2301,7 typedef int (*FuncPtr)(gdImagePtr, int, int); int i, iYPos=0, r, g, b, a; FuncPtr f; - int pxlOldLeft, pxlLeft, pxlSrc; + int pxlOldLeft, pxlLeft=0, pxlSrc; if (src-trueColor) { f = gdImageGetTrueColorPixel; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
At 16:51 14.11.2002, Ilia A. wrote: On November 14, 2002 10:45 am, Marcus Börger wrote: I always compile with all warnings enabled and fix warnings for linux and windows builds. I am mostly using gcc -Wall -Wconversion -ggdb Thanks, I'll add -Wconversion to my CFLAGS. [marcuszaphod PHP_4_3_0]$ gcc -v Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/specs gcc version 2.96 2731 (Mandrake Linux 8.2 2.96-0.76mdk) Sometimes i use a sun as well but i am not fixing warnings for that target. The warning was about pxlLeft propably not bein initialised. This could not happen if every thing is ok. If not Setting it to 0 should result in something debugable. I've tried the fix on the regular gcc 2.95.3 and gcc 3.2 (Sun OS) both did not complain with the regular -Wall -g3 flags. Or do you mean the other fix for the TSRM stuff? My mistake, I usually don't compile with TSRM since some modules do not compile when I use experimental-zts. If this is so == report on php-dev list - my suggestion those or no longer maintained and should be fixed for tsrm and moved to pecl Ilia marcus At 16:27 14.11.2002, Ilia A. wrote: Which compiler are you using and with which options that gave you warning(s) on these lines? Ilia On November 14, 2002 10:08 am, Marcus Boerger wrote: helly Thu Nov 14 10:08:40 2002 EDT Modified files: /php4/ext/gd/libgdgd.c Log: Fix warnings (Marcus Pierre-Alain Joye) Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.25 php4/ext/gd/libgd/gd.c:1.26 --- php4/ext/gd/libgd/gd.c:1.25 Wed Nov 13 15:02:58 2002 +++ php4/ext/gd/libgd/gd.cThu Nov 14 10:08:39 2002 -2215,7 +2215,7 int i, r, g, b, a; FuncPtr f; - int pxlOldLeft, pxlLeft, pxlSrc; + int pxlOldLeft, pxlLeft=0, pxlSrc; if (src-trueColor) { f = gdImageGetTrueColorPixel; -2301,7 +2301,7 typedef int (*FuncPtr)(gdImagePtr, int, int); int i, iYPos=0, r, g, b, a; FuncPtr f; - int pxlOldLeft, pxlLeft, pxlSrc; + int pxlOldLeft, pxlLeft=0, pxlSrc; if (src-trueColor) { f = gdImageGetTrueColorPixel; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php4 /ext/gd/libgd gd.c gd_gd2.c gdft.c
Hello, On Tue, 12 Nov 2002 13:12:59 - Marcus Boerger [EMAIL PROTECTED] wrote: helly Tue Nov 12 08:12:59 2002 EDT Modified files: /php4/ext/gd/libgdgd.c gd_gd2.c gdft.c Log: fix warnings Thx to fix warnings :-) While you are on, here are some warns I got on gd_png.c (-W -g3): php4/ext/gd/libgd/gd_png.c: In function `gdImageCreateFromPngCtx': php4/ext/gd/libgd/gd_png.c:126: warning: variable `image_data' might be clobbered by `longjmp' or `vfork' php4/ext/gd/libgd/gd_png.c:127: warning: variable `row_pointers' might be clobbered by `longjmp' or `vfork' php4/ext/gd/libgd/gd_png.c:129: warning: variable `open' might be clobbered by `longjmp' or `vfork' php4/ext/gd/libgd/gd_png.c: In function `gdImagePngCtx': php4/ext/gd/libgd/gd_png.c:447: warning: variable `bit_depth' might be clobbered by `longjmp' or `vfork' php4/ext/gd/libgd/gd_png.c:450: warning: variable `colors' might be clobbered by `longjmp' or `vfork' hth pa -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
iliaa Tue Oct 29 15:19:38 2002 EDT Modified files: /php4/ext/gd/libgd gd.c Log: Corrected un-initialized variable usage. Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.21 php4/ext/gd/libgd/gd.c:1.22 --- php4/ext/gd/libgd/gd.c:1.21 Mon Oct 28 20:15:44 2002 +++ php4/ext/gd/libgd/gd.c Tue Oct 29 15:19:38 2002 -2216,7 +2216,7 } if (i dst-sx) { - gdImageSetPixel (dst, i, uRow, pxlLeft); + gdImageSetPixel (dst, i, uRow, clrBack); } pxlOldLeft = clrBack; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
rasmus Sun Oct 6 02:47:55 2002 EDT Modified files: /php4/ext/gd/libgd gd.c Log: Fix for bug #19700 - code by Wez Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.17 php4/ext/gd/libgd/gd.c:1.18 --- php4/ext/gd/libgd/gd.c:1.17 Mon Sep 30 03:23:34 2002 +++ php4/ext/gd/libgd/gd.c Sun Oct 6 02:47:53 2002 -1735,6 +1735,36 } return; } + + /* Destination is palette based */ + +if (src-trueColor) { /* But source is truecolor (Ouch!) */ +for (y = srcY; (y (srcY + h)); y++) +{ +tox = dstX; +for (x = srcX; (x (srcX + w)); x++) +{ +int nc; +c = gdImageGetPixel (src, x, y); + +/* Get best match possible. */ +nc = gdImageColorResolveAlpha ( + dst, + gdTrueColorGetRed(c), + gdTrueColorGetGreen(c), + gdTrueColorGetBlue(c), + gdTrueColorGetAlpha(c)); + +gdImageSetPixel (dst, tox, toy, nc); +tox++; +} +toy++; +} +return; +} + + /* Palette based to palette based */ + for (i = 0; (i gdMaxColors); i++) { colorMap[i] = (-1); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php4 /ext/gd/libgd gd.c
rasmus Sun Oct 6 04:39:05 2002 EDT Modified files: /php4/ext/gd/libgd gd.c Log: WS fix - although the entire libgd directory is horrendously formatted. However, since we are forking existing code, fixing it would make it much harder to merge any Boutell patches (if they ever come out with any). Index: php4/ext/gd/libgd/gd.c diff -u php4/ext/gd/libgd/gd.c:1.19 php4/ext/gd/libgd/gd.c:1.20 --- php4/ext/gd/libgd/gd.c:1.19 Sun Oct 6 04:35:22 2002 +++ php4/ext/gd/libgd/gd.c Sun Oct 6 04:39:05 2002 -1739,7 +1739,7 /* Destination is palette based */ if (src-trueColor) { /* But source is truecolor (Ouch!) */ - toy = dstY; +toy = dstY; for (y = srcY; (y (srcY + h)); y++) { tox = dstX; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php