1
0
mirror of https://github.com/php/php-src.git synced 2026-04-30 03:33:17 +02:00

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)
This commit is contained in:
Christoph M. Becker
2016-09-20 00:10:49 +02:00
parent a14c220fd9
commit be30c34fb8
7 changed files with 98 additions and 160 deletions
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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", " \
+94
View File
@@ -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;
-104
View File
@@ -1,104 +0,0 @@
#if HAVE_GD_BUNDLED
# include "gd.h"
#else
# include <gd.h>
#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;
}
}
-52
View File
@@ -1,52 +0,0 @@
#include <stdio.h>
#include <math.h>
#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");
}