]> granicus.if.org Git - php/commitdiff
MFH (Syncronize bunbled GD with gd 2.0.14)
authorIlia Alshanetsky <iliaa@php.net>
Tue, 3 Jun 2003 23:55:15 +0000 (23:55 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Tue, 3 Jun 2003 23:55:15 +0000 (23:55 +0000)
ext/gd/gd.c
ext/gd/libgd/gd.c
ext/gd/libgd/gdft.c

index d48c3c01300fdbe5f0fd723951f076c44c3a38d1..75a3f255c22b4d8f7acab984786ccbdaef69959f 100644 (file)
@@ -386,7 +386,7 @@ PHP_RSHUTDOWN_FUNCTION(gd)
 /* }}} */
 
 #if HAVE_GD_BUNDLED
-#define PHP_GD_VERSION_STRING "bundled (2.0.12 compatible)"
+#define PHP_GD_VERSION_STRING "bundled (2.0.14 compatible)"
 #elif HAVE_LIBGD20
 #define PHP_GD_VERSION_STRING "2.0 or higher"
 #elif HAVE_GDIMAGECOLORRESOLVE
index 2617ca868c68dd9cafd96998a68571ac7fb01296..9f128a5ae630f2843591549424a0e818f1cc9b00 100644 (file)
@@ -873,6 +873,11 @@ static void gdImageAntiAliasedApply (gdImagePtr im, int px, int py)
        float p_dist, p_alpha;
        unsigned char opacity;
 
+       /* 2.0.13: bounds check! AA_opacity is just as capable of overflowing as the main pixel array. Arne Jorgensen. */
+       if (!gdImageBoundsSafeMacro(im, px, py)) {
+               return;
+       }
+
        /* 
         * Find the perpendicular distance from point C (px, py) to the line 
         * segment AB that is being drawn.  (Adapted from an algorithm from the
@@ -2060,12 +2065,8 @@ void gdImageCopyMerge (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int s
                                tox++;
                                continue;
                        }
-                       /* 
-                        * If it's the same image, mapping is NOT trivial since we 
-                        * merge with greyscale target, but if pct is 100, the grey 
-                        * value is not used, so it becomes trivial. pjw 2.0.12. 
-                        */
-                       if (dst == src && pct == 100) {
+                       /* If it's the same image, mapping is trivial */
+                       if (dst == src) {
                                nc = c;
                        } else {
                                dc = gdImageGetPixel(dst, tox, toy);
@@ -2105,8 +2106,12 @@ void gdImageCopyMergeGray (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, i
                                tox++;
                                continue;
                        }
-                       /* If it's the same image, mapping is trivial */
-                       if (dst == src) {
+                       /* 
+                        * If it's the same image, mapping is NOT trivial since we 
+                        * merge with greyscale target, but if pct is 100, the grey 
+                        * value is not used, so it becomes trivial. pjw 2.0.12. 
+                        */
+                       if (dst == src && pct == 100) {
                                nc = c;
                        } else {
                                dc = gdImageGetPixel(dst, tox, toy);
index d978c75ec1eb0bf1926dafe3f544cb798a8e1bd4..f328fddcc8970089a2ff68606bbb93e0ef5ffc7a 100644 (file)
@@ -790,7 +790,8 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
        char *tmpstr = NULL;
        int render = (im && (im->trueColor || (fg <= 255 && fg >= -255)));
        FT_BitmapGlyph bm;
-       int render_mode = FT_LOAD_RENDER | FT_LOAD_FORCE_AUTOHINT;
+       /* 2.0.13: Bob Ostermann: don't force autohint, that's just for testing freetype and doesn't look as good */
+       int render_mode = FT_LOAD_DEFAULT;
        int m, mfound;
        /* Now tuneable thanks to Wez Furlong */
        double linespace = LINESPACE;
@@ -909,6 +910,8 @@ gdImageStringFTEx (gdImage * im, int *brect, int fg, char *fontlist, double ptsi
                }
                /* newlines */
                if (ch == '\n') {
+                       /* 2.0.13: reset penf.x. Christopher J. Grayce */
+                       penf.x = 0;
                          penf.y -= (long)(face->size->metrics.height * linespace);
                          penf.y = (penf.y - 32) & -64;         /* round to next pixel row */
                          x1 = (int)(penf.x * cos_a - penf.y * sin_a + 32) / 64;