From: Christoph M. Becker Date: Mon, 19 Sep 2016 22:10:49 +0000 (+0200) Subject: Sync with libgd wrt. compilation units X-Git-Tag: php-7.2.0alpha1~1235 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=be30c34fb8fd67998fdc27fca21b6ed008552e2a;p=php Sync with libgd wrt. compilation units * integrate gd_arc.c into gd.c (as of gd-2.1.0-alpha1) * rename gd_color.c to gd_color_match.c (as of gd-2.1.0-alpha1) * remove mathmake.c (as of GD_2_0_34RC1) * rename xbm.c to gd_xbm.c (as of gd-2.1.0-alpha1) --- diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 index b7aeeaa1d1..449142841b 100644 --- a/ext/gd/config.m4 +++ b/ext/gd/config.m4 @@ -255,8 +255,8 @@ if test "$PHP_GD" = "yes"; then libgd/gd_png.c libgd/gd_jpeg.c libgd/gdxpm.c libgd/gdfontt.c libgd/gdfonts.c \ libgd/gdfontmb.c libgd/gdfontl.c libgd/gdfontg.c libgd/gdtables.c libgd/gdft.c \ libgd/gdcache.c libgd/gdkanji.c libgd/wbmp.c libgd/gd_wbmp.c libgd/gdhelpers.c \ - libgd/gd_topal.c libgd/gd_gif_in.c libgd/xbm.c libgd/gd_gif_out.c libgd/gd_security.c \ - libgd/gd_filter.c libgd/gd_pixelate.c libgd/gd_arc.c libgd/gd_rotate.c libgd/gd_color.c \ + libgd/gd_topal.c libgd/gd_gif_in.c libgd/gd_xbm.c libgd/gd_gif_out.c libgd/gd_security.c \ + libgd/gd_filter.c libgd/gd_pixelate.c libgd/gd_rotate.c libgd/gd_color_match.c \ libgd/gd_transform.c libgd/gd_crop.c libgd/gd_interpolation.c libgd/gd_matrix.c" dnl check for fabsf and floorf which are available since C99 diff --git a/ext/gd/config.w32 b/ext/gd/config.w32 index 715ea50d89..a27f3b68b0 100644 --- a/ext/gd/config.w32 +++ b/ext/gd/config.w32 @@ -39,8 +39,8 @@ if (PHP_GD != "no") { gdcache.c gdfontg.c gdfontl.c gdfontmb.c gdfonts.c gdfontt.c \ gdft.c gd_gd2.c gd_gd.c gd_gif_in.c gd_gif_out.c gdhelpers.c gd_io.c gd_io_dp.c \ gd_io_file.c gd_io_ss.c gd_jpeg.c gdkanji.c gd_png.c gd_ss.c \ - gdtables.c gd_topal.c gd_wbmp.c gdxpm.c wbmp.c xbm.c gd_security.c gd_transform.c \ - gd_filter.c gd_pixelate.c gd_arc.c gd_rotate.c gd_color.c gd_webp.c \ + gdtables.c gd_topal.c gd_wbmp.c gdxpm.c wbmp.c gd_xbm.c gd_security.c gd_transform.c \ + gd_filter.c gd_pixelate.c gd_rotate.c gd_color_match.c gd_webp.c \ gd_crop.c gd_interpolation.c gd_matrix.c", "gd"); AC_DEFINE('HAVE_LIBGD', 1, 'GD support'); ADD_FLAG("CFLAGS_GD", " \ diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index dd38a11cb9..35b439772d 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -1775,6 +1775,100 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e } } +/** + * Integer Ellipse functions (gdImageEllipse and gdImageFilledEllipse) + * Function added by Pierre-Alain Joye 02/08/2003 (paj@pearfr.org) + * 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) +{ + int x=0,mx1=0,mx2=0,my1=0,my2=0; + long aq,bq,dx,dy,r,rx,ry,a,b; + + a=w>>1; + b=h>>1; + 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_y2; + + a=w>>1; + b=h>>1; + + for (x = mx-a; x <= mx+a; x++) { + gdImageSetPixel(im, x, 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=-2; + 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); + gdImageSetPixel(im,i,my2,c); + } + } + old_y2 = my2; + } +} + void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color) { int lastBorder; diff --git a/ext/gd/libgd/gd_arc.c b/ext/gd/libgd/gd_arc.c deleted file mode 100644 index 1c74871388..0000000000 --- a/ext/gd/libgd/gd_arc.c +++ /dev/null @@ -1,104 +0,0 @@ -#if HAVE_GD_BUNDLED -# include "gd.h" -#else -# include -#endif - -#include "gd_intern.h" - - -/** - * Integer Ellipse functions (gdImageEllipse and gdImageFilledEllipse) - * Function added by Pierre-Alain Joye 02/08/2003 (paj@pearfr.org) - * 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) -{ - int x=0,mx1=0,mx2=0,my1=0,my2=0; - long aq,bq,dx,dy,r,rx,ry,a,b; - - a=w>>1; - b=h>>1; - 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_y2; - - a=w>>1; - b=h>>1; - - for (x = mx-a; x <= mx+a; x++) { - gdImageSetPixel(im, x, 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=-2; - 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); - gdImageSetPixel(im,i,my2,c); - } - } - old_y2 = my2; - } -} - - diff --git a/ext/gd/libgd/gd_color.c b/ext/gd/libgd/gd_color_match.c similarity index 100% rename from ext/gd/libgd/gd_color.c rename to ext/gd/libgd/gd_color_match.c diff --git a/ext/gd/libgd/xbm.c b/ext/gd/libgd/gd_xbm.c similarity index 100% rename from ext/gd/libgd/xbm.c rename to ext/gd/libgd/gd_xbm.c diff --git a/ext/gd/libgd/mathmake.c b/ext/gd/libgd/mathmake.c deleted file mode 100644 index 3950c4b09c..0000000000 --- a/ext/gd/libgd/mathmake.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include - -#define scale 1024 - -int basis[91]; -int cost[360]; - -main (void) -{ - int i; - printf ("#define costScale %d\n", scale); - printf ("int cost[] = {\n "); - for (i = 0; (i <= 90); i++) - { - basis[i] = cos ((double) i * .0174532925) * scale; - } - for (i = 0; (i < 90); i++) - { - printf ("%d,\n ", cost[i] = basis[i]); - } - for (i = 90; (i < 180); i++) - { - printf ("%d,\n ", cost[i] = -basis[180 - i]); - } - for (i = 180; (i < 270); i++) - { - printf ("%d,\n ", cost[i] = -basis[i - 180]); - } - for (i = 270; (i < 359); i++) - { - printf ("%d,\n ", cost[i] = basis[360 - i]); - } - printf ("%d\n", cost[359] = basis[1]); - printf ("};\n"); - printf ("#define sintScale %d\n", scale); - printf ("int sint[] = {\n "); - for (i = 0; (i < 360); i++) - { - int val; - val = cost[(i + 270) % 360]; - if (i != 359) - { - printf ("%d,\n ", val); - } - else - { - printf ("%d\n", val); - } - } - printf ("};\n"); -}