SOURCES: php4-gd.patch - brind entire libgd, too

arekm arekm at pld-linux.org
Tue Jan 22 22:47:05 CET 2008


Author: arekm                        Date: Tue Jan 22 21:47:05 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- brind entire libgd, too

---- Files affected:
SOURCES:
   php4-gd.patch (1.5 -> 1.6) 

---- Diffs:

================================================================
Index: SOURCES/php4-gd.patch
diff -u SOURCES/php4-gd.patch:1.5 SOURCES/php4-gd.patch:1.6
--- SOURCES/php4-gd.patch:1.5	Tue Jan 22 15:06:09 2008
+++ SOURCES/php4-gd.patch	Tue Jan 22 22:46:59 2008
@@ -1,6 +1,6 @@
 diff -urN php-4.4.8.org/ext/gd/config.m4 php-4.4.8/ext/gd/config.m4
 --- php-4.4.8.org/ext/gd/config.m4	2007-03-10 14:06:37.000000000 +0100
-+++ php-4.4.8/ext/gd/config.m4	2008-01-22 14:59:28.606647293 +0100
++++ php-4.4.8/ext/gd/config.m4	2008-01-22 22:38:05.833815388 +0100
 @@ -259,12 +259,13 @@
    PHP_CHECK_LIBRARY(gd, gdCacheCreate,          [AC_DEFINE(HAVE_GD_CACHE_CREATE,     1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
    PHP_CHECK_LIBRARY(gd, gdFontCacheShutdown,    [AC_DEFINE(HAVE_GD_FONTCACHESHUTDOWN,1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ])
@@ -16,13 +16,7 @@
  
  if test "$PHP_GD" = "yes"; then
    GD_MODULE_TYPE=builtin
-@@ -305,11 +306,12 @@
-   AC_DEFINE(HAVE_GD_GD2,              1, [ ])
-   AC_DEFINE(HAVE_GD_PNG,              1, [ ])
-   AC_DEFINE(HAVE_GD_XBM,              1, [ ])
--  AC_DEFINE(HAVE_GD_BUNDLED,          1, [ ])
-+dnl  AC_DEFINE(HAVE_GD_BUNDLED,          1, [ ])
-   AC_DEFINE(HAVE_GD_GIF_READ,         1, [ ])
+@@ -310,6 +311,7 @@
    AC_DEFINE(HAVE_GD_GIF_CREATE,       1, [ ])
    AC_DEFINE(HAVE_GD_IMAGEELLIPSE,     1, [ ])
    AC_DEFINE(HAVE_GD_FONTCACHESHUTDOWN,1, [ ])
@@ -32,14 +26,14 @@
  
 diff -urN php-4.4.8.org/ext/gd/CREDITS php-4.4.8/ext/gd/CREDITS
 --- php-4.4.8.org/ext/gd/CREDITS	2003-03-01 02:16:00.000000000 +0100
-+++ php-4.4.8/ext/gd/CREDITS	2008-01-22 14:35:21.033975591 +0100
++++ php-4.4.8/ext/gd/CREDITS	2008-01-22 22:38:05.837148890 +0100
 @@ -1,2 +1,2 @@
  GD imaging
 -Rasmus Lerdorf, Stig Bakken, Jim Winstead, Jouni Ahto, Ilia Alshanetsky, Pierre-Alain Joye
 +Rasmus Lerdorf, Stig Bakken, Jim Winstead, Jouni Ahto, Ilia Alshanetsky, Pierre-Alain Joye, Marcus Boerger
 diff -urN php-4.4.8.org/ext/gd/gd.c php-4.4.8/ext/gd/gd.c
 --- php-4.4.8.org/ext/gd/gd.c	2007-12-31 08:22:47.000000000 +0100
-+++ php-4.4.8/ext/gd/gd.c	2008-01-22 14:52:54.373545829 +0100
++++ php-4.4.8/ext/gd/gd.c	2008-01-22 22:38:05.837148890 +0100
 @@ -1,8 +1,8 @@
  /*
     +----------------------------------------------------------------------+
@@ -1293,7 +1287,7 @@
   * tab-width: 4
 diff -urN php-4.4.8.org/ext/gd/gdcache.c php-4.4.8/ext/gd/gdcache.c
 --- php-4.4.8.org/ext/gd/gdcache.c	2005-01-09 22:05:31.000000000 +0100
-+++ php-4.4.8/ext/gd/gdcache.c	2008-01-22 14:35:21.037309093 +0100
++++ php-4.4.8/ext/gd/gdcache.c	2008-01-22 22:38:05.863816915 +0100
 @@ -1,8 +1,8 @@
 -/* 
 - * $Id$
@@ -1344,7 +1338,7 @@
  	head->mru = NULL;
 diff -urN php-4.4.8.org/ext/gd/gdcache.h php-4.4.8/ext/gd/gdcache.h
 --- php-4.4.8.org/ext/gd/gdcache.h	2003-03-05 17:04:20.000000000 +0100
-+++ php-4.4.8/ext/gd/gdcache.h	2008-01-22 14:35:21.040642595 +0100
++++ php-4.4.8/ext/gd/gdcache.h	2008-01-22 22:38:05.863816915 +0100
 @@ -1,8 +1,8 @@
 -/* 
 - * $Id$ 
@@ -1383,7 +1377,7 @@
   * In the current implementation the cache is traversed by a linear
 diff -urN php-4.4.8.org/ext/gd/gd_ctx.c php-4.4.8/ext/gd/gd_ctx.c
 --- php-4.4.8.org/ext/gd/gd_ctx.c	2007-12-31 08:22:47.000000000 +0100
-+++ php-4.4.8/ext/gd/gd_ctx.c	2008-01-22 14:35:21.040642595 +0100
++++ php-4.4.8/ext/gd/gd_ctx.c	2008-01-22 22:38:05.863816915 +0100
 @@ -1,13 +1,13 @@
  /*
     +----------------------------------------------------------------------+
@@ -1553,7 +1547,7 @@
 + */
 diff -urN php-4.4.8.org/ext/gd/gd.dsp php-4.4.8/ext/gd/gd.dsp
 --- php-4.4.8.org/ext/gd/gd.dsp	2007-05-03 04:55:11.000000000 +0200
-+++ php-4.4.8/ext/gd/gd.dsp	2008-01-22 14:35:21.040642595 +0100
++++ php-4.4.8/ext/gd/gd.dsp	2008-01-22 22:38:05.887151436 +0100
 @@ -54,9 +54,9 @@
  # ADD BASE BSC32 /nologo
  # ADD BSC32 /nologo
@@ -1825,7 +1819,7 @@
  
 diff -urN php-4.4.8.org/ext/gd/gdttf.c php-4.4.8/ext/gd/gdttf.c
 --- php-4.4.8.org/ext/gd/gdttf.c	2005-01-09 22:05:31.000000000 +0100
-+++ php-4.4.8/ext/gd/gdttf.c	2008-01-22 14:35:21.040642595 +0100
++++ php-4.4.8/ext/gd/gdttf.c	2008-01-22 22:38:05.887151436 +0100
 @@ -2,7 +2,7 @@
  /*                                          */
  /* John Ellson   ellson at lucent.com          */
@@ -2627,9 +2621,7540 @@
  #endif /* HAVE_LIBTTF */
  
  /*
+diff -urN php-4.4.8.org/ext/gd/libgd/gd_arc_f_buggy.c php-4.4.8/ext/gd/libgd/gd_arc_f_buggy.c
+--- php-4.4.8.org/ext/gd/libgd/gd_arc_f_buggy.c	2003-03-05 17:04:20.000000000 +0100
++++ php-4.4.8/ext/gd/libgd/gd_arc_f_buggy.c	2005-08-18 14:54:43.000000000 +0200
+@@ -1,6 +1,6 @@
+ /* This is potentially great stuff, but fails against the test
+-   program at the end. This would probably be much more 
+-   efficent than the implementation currently in gd.c if the 
++   program at the end. This would probably be much more
++   efficent than the implementation currently in gd.c if the
+    errors in the output were corrected. TBB */
+ 
+ #if 0
+@@ -698,7 +698,7 @@
+ #define WIDTH	500
+ #define HEIGHT	300
+ 
+-int 
++int
+ main (int argc, char *argv[])
+ {
+   gdImagePtr im = gdImageCreate (WIDTH, HEIGHT);
+@@ -726,12 +726,12 @@
+   out = fopen ("test/arctest.png", "wb");
+   if (!out)
+     {
+-      php_gd_error("Can't create test/arctest.png\n");
++      php_gd_error("Can't create test/arctest.png");
+       exit (1);
+     }
+   gdImagePng (im, out);
+   fclose (out);
+-  php_gd_error("Test image written to test/arctest.png\n");
++  php_gd_error("Test image written to test/arctest.png");
+   /* Destroy it */
+   gdImageDestroy (im);
+ 
+diff -urN php-4.4.8.org/ext/gd/libgd/gd.c php-4.4.8/ext/gd/libgd/gd.c
+--- php-4.4.8.org/ext/gd/libgd/gd.c	2007-10-20 17:29:04.000000000 +0200
++++ php-4.4.8/ext/gd/libgd/gd.c	2007-11-05 00:56:00.000000000 +0100
+@@ -1,4 +1,4 @@
+-#include <stdio.h>
++
+ #include <math.h>
+ #include <string.h>
+ #include <stdlib.h>
+@@ -90,18 +90,16 @@
+ static void gdImageBrushApply(gdImagePtr im, int x, int y);
+ static void gdImageTileApply(gdImagePtr im, int x, int y);
+ static void gdImageAntiAliasedApply(gdImagePtr im, int x, int y);
+-static int gdFullAlphaBlend(int dst, int src);
+ static int gdLayerOverlay(int dst, int src);
+-static int gdAlphaBlendColor(int b1, int b2, int a1, int a2);
+ static int gdAlphaOverlayColor(int src, int dst, int max);
+ int gdImageGetTrueColorPixel(gdImagePtr im, int x, int y);
+ 
+-void php_gd_error_ex(int type, const char *format, ...) 
++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);
+@@ -110,9 +108,9 @@
+ 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);
+@@ -122,11 +120,20 @@
+ {
+ 	int i;
+ 	gdImagePtr im;
+-	im = (gdImage *) gdMalloc(sizeof(gdImage));
+-	memset(im, 0, sizeof(gdImage));
++
++	if (overflow2(sx, sy)) {
++		return NULL;
++	}
++
++	if (overflow2(sizeof(unsigned char *), sy)) {
++		return NULL;
++	}
++
++	im = (gdImage *) gdCalloc(1, sizeof(gdImage));
++
+ 	/* Row-major ever since gd 1.3 */
+-	im->pixels = (unsigned char **) safe_emalloc(sizeof(unsigned char *), sy, 0);
+-	im->AA_opacity = (unsigned char **) safe_emalloc(sizeof(unsigned char *), sy, 0);
++	im->pixels = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy);
++	im->AA_opacity = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy);
+ 	im->polyInts = 0;
+ 	im->polyAllocated = 0;
+ 	im->brush = 0;
+@@ -164,10 +171,23 @@
+ {
+ 	int i;
+ 	gdImagePtr im;
++
++	if (overflow2(sx, sy)) {
++		return NULL;
++	}
++
++	if (overflow2(sizeof(unsigned char *), sy)) {
++		return NULL;
++	}
++	
++	if (overflow2(sizeof(int), sx)) {
++		return NULL;
++	}
++
+ 	im = (gdImage *) gdMalloc(sizeof(gdImage));
+ 	memset(im, 0, sizeof(gdImage));
+-	im->tpixels = (int **) safe_emalloc(sizeof(int *), sy, 0);
+-	im->AA_opacity = (unsigned char **) safe_emalloc(sizeof(unsigned char *), sy, 0);
++	im->tpixels = (int **) gdMalloc(sizeof(int *) * sy);
++	im->AA_opacity = (unsigned char **) gdMalloc(sizeof(unsigned char *) * sy);
+ 	im->polyInts = 0;
+ 	im->polyAllocated = 0;
+ 	im->brush = 0;
+@@ -267,8 +287,8 @@
+ }
+ 
+ /* This code is taken from http://www.acm.org/jgt/papers/SmithLyons96/hwb_rgb.html, an article
+- * on colour conversion to/from RBG and HWB colour systems. 
+- * It has been modified to return the converted value as a * parameter. 
++ * on colour conversion to/from RBG and HWB colour systems.
++ * It has been modified to return the converted value as a * parameter.
+  */
+ 
+ #define RETURN_HWB(h, w, b) {HWB->H = h; HWB->W = w; HWB->B = b; return HWB;}
+@@ -287,8 +307,8 @@
+ 
+ 
+ /*
+- * Theoretically, hue 0 (pure red) is identical to hue 6 in these transforms. Pure 
+- * red always maps to 6 in this implementation. Therefore UNDEFINED can be 
++ * Theoretically, hue 0 (pure red) is identical to hue 6 in these transforms. Pure
++ * red always maps to 6 in this implementation. Therefore UNDEFINED can be
+  * defined as 0 in situations where only unsigned numbers are desired.
+  */
+ typedef struct
+@@ -305,8 +325,8 @@
+ static HWBType * RGB_to_HWB (RGBType RGB, HWBType * HWB)
+ {
+ 	/*
+-	 * RGB are each on [0, 1]. W and B are returned on [0, 1] and H is  
+-	 * returned on [0, 6]. Exception: H is returned UNDEFINED if W == 1 - B.  
++	 * RGB are each on [0, 1]. W and B are returned on [0, 1] and H is
++	 * returned on [0, 6]. Exception: H is returned UNDEFINED if W == 1 - B.
+ 	 */
+ 
+ 	float R = RGB.R, G = RGB.G, B = RGB.B, w, v, b, f;
+@@ -320,7 +340,7 @@
+ 	}
+ 	f = (R == w) ? G - B : ((G == w) ? B - R : R - G);
+ 	i = (R == w) ? 3 : ((G == w) ? 5 : 1);
+-	
++
+ 	RETURN_HWB(i - f / (v - w), w, b);
+ }
+ 
+@@ -363,9 +383,9 @@
+  */
+ static RGBType * HWB_to_RGB (HWBType HWB, RGBType * RGB)
+ {
+-	/* 
+-	 * H is given on [0, 6] or UNDEFINED. W and B are given on [0, 1].  
+-	 * RGB are each returned on [0, 1]. 
++	/*
++	 * H is given on [0, 6] or UNDEFINED. W and B are given on [0, 1].
++	 * RGB are each returned on [0, 1].
+ 	 */
+ 
+ 	float h = HWB.H, w = HWB.W, b = HWB.B, v, n, f;
+@@ -478,7 +498,7 @@
+ 	im->blue[ct] = b;
+ 	im->alpha[ct] = a;
+ 	im->open[ct] = 0;
+-	
++
+ 	return ct;
+ }
+ 
+@@ -629,7 +649,7 @@
+  * Given the end points of a line, and a bounding rectangle (which we
+  * know to be from (0,0) to (SX,SY)), adjust the endpoints to be on
+  * the edges of the rectangle if the line should be drawn at all,
+- * otherwise return a failure code 
++ * otherwise return a failure code
+  */
+ 
+ /* this does "one-dimensional" clipping: note that the second time it
+@@ -637,7 +657,7 @@
+  *  - the comments ignore this (if you can understand it when it's
+  *  looking at the X parameters, it should become clear what happens on
+  *  the second call!)  The code is simplified from that in the article,
+- *  as we know that gd images always start at (0,0) 
++ *  as we know that gd images always start at (0,0)
+  */
+ 
+ static int clip_1d(int *x0, int *y0, int *x1, int *y1, int maxdim) {
+@@ -664,7 +684,7 @@
+ 		}
+ 		m = (*y1 - *y0)/(double)(*x1 - *x0);  /* calculate the slope of the line */
+ 		*y0 += (int)(m * (maxdim - *x0)); /* adjust so point is on the right boundary */
+-		*x0 = maxdim;                  
++		*x0 = maxdim;
+ 		/* now, perhaps, adjust the end of the line */
+ 		if (*x1 < 0) {
+ 			*y1 -= (int)(m * *x1);
+@@ -737,7 +757,7 @@
+ 							im->tpixels[y][x] = gdAlphaBlend(im->tpixels[y][x], color);
+ 							break;
+ 						case gdEffectNormal:
+-							im->tpixels[y][x] = gdFullAlphaBlend(im->tpixels[y][x], color);
++							im->tpixels[y][x] = gdAlphaBlend(im->tpixels[y][x], color);
+ 							break;
+ 						case gdEffectOverlay :
+ 							im->tpixels[y][x] = gdLayerOverlay(im->tpixels[y][x], color);
+@@ -756,7 +776,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;
+ 	}
+@@ -780,7 +800,7 @@
+ 	x1 = x - hx;
+ 	x2 = x1 + gdImageSX(im->brush);
+ 	srcy = 0;
+-	
++
+ 	if (im->trueColor) {
+ 		if (im->brush->trueColor) {
+ 			for (ly = y1; ly < y2; ly++) {
+@@ -823,8 +843,8 @@
+ 				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), 
++						gdImageSetPixel(im, lx, ly, gdImageColorResolveAlpha(im, gdTrueColorGetRed(p),
++													 gdTrueColorGetGreen(p),
+ 													 gdTrueColorGetBlue(p),
+ 													 gdTrueColorGetAlpha(p)));
+ 					} else {
+@@ -849,7 +869,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 */
+@@ -903,8 +925,8 @@
+ 	float p_dist, p_alpha;
+ 	unsigned char opacity;
+ 
+-	/* 
+-	 * Find the perpendicular distance from point C (px, py) to the line 
++	/*
++	 * Find the perpendicular distance from point C (px, py) to the line
+ 	 * segment AB that is being drawn.  (Adapted from an algorithm from the
+ 	 * comp.graphics.algorithms FAQ.)
+ 	 */
+@@ -918,7 +940,7 @@
+ 	int By_Cy = im->AAL_y2 - py;
+ 
+ 	/* 2.0.13: bounds check! AA_opacity is just as capable of
+-	 * overflowing as the main pixel array. Arne Jorgensen. 
++	 * overflowing as the main pixel array. Arne Jorgensen.
+ 	 * 2.0.14: typo fixed. 2.0.15: moved down below declarations
+ 	 * to satisfy non-C++ compilers.
+ 	 */
+@@ -931,12 +953,12 @@
+ 	LBC_2 = (Bx_Cx * Bx_Cx) + (By_Cy * By_Cy);
+ 
+ 	if (((im->AAL_LAB_2 + LAC_2) >= LBC_2) && ((im->AAL_LAB_2 + LBC_2) >= LAC_2)) {
+-		/* The two angles are acute.  The point lies inside the portion of the 
++		/* The two angles are acute.  The point lies inside the portion of the
+ 		 * plane spanned by the line segment.
+ 		 */
+ 		p_dist = fabs ((float) ((Ay_Cy * im->AAL_Bx_Ax) - (Ax_Cx * im->AAL_By_Ay)) / im->AAL_LAB);
+ 	} else {
+-		/* The point is past an end of the line segment.  It's length from the 
++		/* The point is past an end of the line segment.  It's length from the
+ 		 * segment is the shorter of the lengths from the endpoints, but call
+ 		 * the distance -1, so as not to compute the alpha nor draw the pixel.
+ 		 */
+@@ -1017,6 +1039,43 @@
+ 	}
+ }
+ 
++static void gdImageHLine(gdImagePtr im, int y, int x1, int x2, int col)
++{
++	if (im->thick > 1) {
++		int thickhalf = im->thick >> 1;
++		gdImageFilledRectangle(im, x1, y - thickhalf, x2, y + im->thick - thickhalf - 1, col);
++	} else {
++		if (x2 < x1) {
++			int t = x2;
++			x2 = x1;
++			x1 = t;
++		}
++
++		for (;x1 <= x2; x1++) {
++			gdImageSetPixel(im, x1, y, col);
++		}
++	}
++	return;
++}
++
++static void gdImageVLine(gdImagePtr im, int x, int y1, int y2, int col)
++{
++	if (im->thick > 1) {
++		int thickhalf = im->thick >> 1;
++		gdImageFilledRectangle(im, x - thickhalf, y1, x + im->thick - thickhalf - 1, y2, col);
++	} else {
++		if (y2 < y1) {
++			int t = y1;
++			y1 = y2;
++			y2 = t;
++		}
++
++		for (;y1 <= y2; y1++) {
++			gdImageSetPixel(im, x, y1, col);
++		}
++	}
++	return;
++}
+ 
+ /* Bresenham as presented in Foley & Van Dam */
+ void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
+@@ -1026,39 +1085,47 @@
+ 	int w, wstart;
+ 	int thick = im->thick;
+ 
++	if (color == gdAntiAliased)
++	{
++		/* 
++		   gdAntiAliased passed as color: use the much faster, much cheaper
++		   and equally attractive gdImageAALine implementation. That
++		   clips too, so don't clip twice.
++		   */
++		gdImageAALine(im, x1, y1, x2, y2, im->AA_color); 
++		return;
++	}
++
+ 	/* 2.0.10: Nick Atty: clip to edges of drawing rectangle, return if no points need to be drawn */
+ 	if (!clip_1d(&x1,&y1,&x2,&y2,gdImageSX(im)) || !clip_1d(&y1,&x1,&y2,&x2,gdImageSY(im))) {
+ 		return;
+ 	}
+ 
+-	/* gdAntiAliased passed as color: set anti-aliased line (AAL) global vars. */
+-	if (color == gdAntiAliased) {
+-		im->AAL_x1 = x1;
+-		im->AAL_y1 = y1;
+-		im->AAL_x2 = x2;
+-		im->AAL_y2 = y2;
+-
+-		/* Compute what we can for point-to-line distance calculation later. */
+-		im->AAL_Bx_Ax = x2 - x1;
+-		im->AAL_By_Ay = y2 - y1;
+-		im->AAL_LAB_2 = (im->AAL_Bx_Ax * im->AAL_Bx_Ax) + (im->AAL_By_Ay * im->AAL_By_Ay);
+-		im->AAL_LAB = sqrt (im->AAL_LAB_2);
++	dx = abs (x2 - x1);
++	dy = abs (y2 - y1);
+ 
+-		/* For AA, we must draw pixels outside the width of the line.  Keep in
+-		 * mind that this will be curtailed by cos/sin of theta later. 
+-		 */
+-		thick += 4;
++	if (dx == 0) {
++		gdImageVLine(im, x1, y1, y2, color);
++		return;
++	} else if (dy == 0) {
++		gdImageHLine(im, y1, x1, x2, color);
++		return;
+ 	}
+-	
+-	dx = abs(x2 - x1);
+-	dy = abs(y2 - y1);
++
+ 	if (dy <= dx) {
+ 		/* More-or-less horizontal. use wid for vertical stroke */
+ 		/* Doug Claar: watch out for NaN in atan2 (2.0.5) */
+ 		if ((dx == 0) && (dy == 0)) {
+ 			wid = 1;
+ 		} else {
+-			wid = (int)(thick * cos (atan2 (dy, dx)));
++			/* 2.0.12: Michael Schwartz: divide rather than multiply;
++TBB: but watch out for /0! */
++			double ac = cos (atan2 (dy, dx));
++			if (ac != 0) {
++				wid = thick / ac;
++			} else {
++				wid = 1;
++			}
+ 			if (wid == 0) {
+ 				wid = 1;
+ 			}
+@@ -1115,16 +1182,17 @@
+ 		}
+ 	} else {
+ 		/* More-or-less vertical. use wid for horizontal stroke */
+-		/* 2.0.12: Michael Schwartz: divide rather than multiply; 
+-		   TBB: but watch out for /0! */
+-		double as = sin(atan2(dy, dx));
++		/* 2.0.12: Michael Schwartz: divide rather than multiply;
++           TBB: but watch out for /0! */
++		double as = sin (atan2 (dy, dx));
+ 		if (as != 0) {
+-			if (!(wid = thick / as)) {
+-				wid = 1;
+-			}
++			wid = thick / as;
+ 		} else {
+ 			wid = 1;
+ 		}
++		if (wid == 0) {
++			wid = 1;
++		}
+ 
+ 		d = 2 * dx - dy;
+ 		incr1 = 2 * dx;
+@@ -1177,11 +1245,6 @@
+ 			}
+ 		}
+ 	}
+-
+-	/* If this is the only line we are drawing, go ahead and blend. */
+-	if (color == gdAntiAliased && !im->AA_polygon) {
+-		gdImageAABlend(im);
+-	}
+ }
+ 
+ 
+@@ -1207,7 +1270,7 @@
+ 	BLEND_COLOR(t, dg, g, dg);
+ 	BLEND_COLOR(t, db, b, db);
+ 	im->tpixels[y][x]=gdTrueColorAlpha(dr, dg, db,  gdAlphaOpaque);
+-}  
++}
+ 
+ /*
+  * Added on 2003/12 by Pierre-Alain Joye (pajoye at pearfr.org)
+@@ -1586,9 +1649,9 @@
+ 
+ /* s and e are integers modulo 360 (degrees), with 0 degrees
+    being the rightmost extreme and degrees changing clockwise.
+-   cx and cy are the center in pixels; w and h are the horizontal 
++   cx and cy are the center in pixels; w and h are the horizontal
+    and vertical diameter in pixels. Nice interface, but slow.
+-   See gd_arc_f_buggy.c for a better version that doesn't 
++   See gd_arc_f_buggy.c for a better version that doesn't
+    seem to be bug-free yet. */
+ 
+ void gdImageArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e, int color)
+@@ -1607,29 +1670,30 @@
+ 	int lx = 0, ly = 0;
+ 	int fx = 0, fy = 0;
+ 
+-	if ((s % 360)  == (e % 360)) {
++
++    if ((s % 360)  == (e % 360)) {
+ 		s = 0; e = 360;
+-	} else {
+-		if (s > 360) {
+-			s = s % 360;
+-		}
++    } else {
++        if (s > 360) {
++            s = s % 360;
++        }
+ 
+-		if (e > 360) {
+-			e = e % 360;
+-		}
++        if (e > 360) {
++            e = e % 360;
++        }
+ 
+-		while (s < 0) {
+-			s += 360;
+-		}
++        while (s < 0) {
++            s += 360;
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/php4-gd.patch?r1=1.5&r2=1.6&f=u



More information about the pld-cvs-commit mailing list