Author: arekm                        Date: Tue Jan 22 13:47:02 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- update from current 5.2; needs some tweaks

---- Files affected:
SOURCES:
   php4-gd.patch (1.3 -> 1.4) 

---- Diffs:

================================================================
Index: SOURCES/php4-gd.patch
diff -u SOURCES/php4-gd.patch:1.3 SOURCES/php4-gd.patch:1.4
--- SOURCES/php4-gd.patch:1.3   Wed May 30 22:14:44 2007
+++ SOURCES/php4-gd.patch       Tue Jan 22 14:46:56 2008
@@ -1,7 +1,7 @@
-diff -urN php-4.4.7.org/ext/gd/config.m4 php-4.4.7/ext/gd/config.m4
---- php-4.4.7.org/ext/gd/config.m4     2007-03-10 14:06:37.000000000 +0100
-+++ php-4.4.7/ext/gd/config.m4 2007-05-30 22:09:19.568683975 +0200
-@@ -259,6 +259,7 @@
+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:35:21.033975591 +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 ])
    PHP_CHECK_LIBRARY(gd, gdFreeFontCache,        
[AC_DEFINE(HAVE_GD_FREEFONTCACHE,    1, [ ])], [], [ -L$GD_LIB 
$GD_SHARED_LIBADD ])
@@ -9,6 +9,13 @@
    PHP_CHECK_LIBRARY(gd, gdNewDynamicCtxEx,      
[AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX,   1, [ ])], [], [ -L$GD_LIB 
$GD_SHARED_LIBADD ])
  ])
  
+ dnl
+ dnl Main GD configure
+-dnl 
++dnl
+ 
+ if test "$PHP_GD" = "yes"; then
+   GD_MODULE_TYPE=builtin
 @@ -310,6 +311,7 @@
    AC_DEFINE(HAVE_GD_GIF_CREATE,       1, [ ])
    AC_DEFINE(HAVE_GD_IMAGEELLIPSE,     1, [ ])
@@ -17,1763 +24,1269 @@
    AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX,   1, [ ])
    AC_DEFINE(HAVE_GD_GIF_CTX,          1, [ ])
  
-diff -urN php-4.4.7.org/ext/gd/gd.c php-4.4.7/ext/gd/gd.c
---- php-4.4.7.org/ext/gd/gd.c  2007-01-01 10:46:42.000000000 +0100
-+++ php-4.4.7/ext/gd/gd.c      2007-05-30 21:48:29.386645975 +0200
-@@ -333,6 +333,9 @@
+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
+@@ -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:35:21.037309093 +0100
+@@ -1,8 +1,8 @@
+ /*
+    +----------------------------------------------------------------------+
+-   | PHP Version 4                                                        |
++   | PHP Version 5                                                        |
+    +----------------------------------------------------------------------+
+-   | Copyright (c) 1997-2008 The PHP Group                                |
++   | Copyright (c) 1997-2007 The PHP Group                                |
+    +----------------------------------------------------------------------+
+    | This source file is subject to version 3.01 of the PHP license,      |
+    | that is bundled with this package in the file LICENSE, and is        |
+@@ -13,14 +13,14 @@
+    | [EMAIL PROTECTED] so we can mail you a copy immediately.               |
+    +----------------------------------------------------------------------+
+    | Authors: Rasmus Lerdorf <[EMAIL PROTECTED]>                             |
+-   |          Stig Bakken <[EMAIL PROTECTED]>                                 
  |
++   |          Stig Bakken <[EMAIL PROTECTED]>                                 
  |
+    |          Jim Winstead <[EMAIL PROTECTED]>                                
 |
+    +----------------------------------------------------------------------+
+  */
+ 
+-/* $Id$ */
++/* $Id$ */
+ 
+-/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, 
++/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
+    Cold Spring Harbor Labs. */
+ 
+ /* Note that there is no code from the gd package in this file */
+@@ -29,7 +29,13 @@
+ #include "config.h"
+ #endif
+ 
++#ifdef HAVE_GD_PNG
++/* needs to be first */
++#include <png.h>
++#endif
++
+ #include "php.h"
++#include "php_ini.h"
+ #include "ext/standard/head.h"
+ #include <math.h>
+ #include "SAPI.h"
+@@ -46,6 +52,9 @@
+ #ifdef PHP_WIN32
+ # include <io.h>
+ # include <fcntl.h>
++#include <windows.h>
++#include <Winuser.h>
++#include <Wingdi.h>
+ #endif
+ 
+ #if HAVE_LIBGD
+@@ -68,6 +77,14 @@
+ #include "libgd/wbmp.h"
+ #endif
+ #ifdef ENABLE_GD_TTF
++# ifdef HAVE_LIBFREETYPE
++#  include <ft2build.h>
++#  include FT_FREETYPE_H
++# else
++#  ifdef HAVE_LIBTTF
++#   include <freetype.h>
++#  endif
++# endif
+ # include "gdttf.h"
+ #endif
+ 
+@@ -112,6 +129,40 @@
+ #define gdNewDynamicCtxEx(len, data, val) gdNewDynamicCtx(len, data)
+ #endif
+ 
++/* Section Filters Declarations */
++/* IMPORTANT NOTE FOR NEW FILTER
++ * Do not forget to update:
++ * IMAGE_FILTER_MAX: define the last filter index
++ * IMAGE_FILTER_MAX_ARGS: define the biggest amout of arguments
++ * image_filter array in PHP_FUNCTION(imagefilter)
++ * */
++#if HAVE_GD_BUNDLED
++#define IMAGE_FILTER_NEGATE         0
++#define IMAGE_FILTER_GRAYSCALE      1
++#define IMAGE_FILTER_BRIGHTNESS     2
++#define IMAGE_FILTER_CONTRAST       3
++#define IMAGE_FILTER_COLORIZE       4
++#define IMAGE_FILTER_EDGEDETECT     5
++#define IMAGE_FILTER_EMBOSS         6
++#define IMAGE_FILTER_GAUSSIAN_BLUR  7
++#define IMAGE_FILTER_SELECTIVE_BLUR 8
++#define IMAGE_FILTER_MEAN_REMOVAL   9
++#define IMAGE_FILTER_SMOOTH         10
++#define IMAGE_FILTER_MAX            10
++#define IMAGE_FILTER_MAX_ARGS       5
++static void php_image_filter_negate(INTERNAL_FUNCTION_PARAMETERS);
++static void php_image_filter_grayscale(INTERNAL_FUNCTION_PARAMETERS);
++static void php_image_filter_brightness(INTERNAL_FUNCTION_PARAMETERS);
++static void php_image_filter_contrast(INTERNAL_FUNCTION_PARAMETERS);
++static void php_image_filter_colorize(INTERNAL_FUNCTION_PARAMETERS);
++static void php_image_filter_edgedetect(INTERNAL_FUNCTION_PARAMETERS);
++static void php_image_filter_emboss(INTERNAL_FUNCTION_PARAMETERS);
++static void php_image_filter_gaussian_blur(INTERNAL_FUNCTION_PARAMETERS);
++static void php_image_filter_selective_blur(INTERNAL_FUNCTION_PARAMETERS);
++static void php_image_filter_mean_removal(INTERNAL_FUNCTION_PARAMETERS);
++static void php_image_filter_smooth(INTERNAL_FUNCTION_PARAMETERS);
++#endif
++/* End Section filters declarations */
+ static gdImagePtr _php_image_create_from_string (zval **Data, char *tn, 
gdImagePtr (*ioctx_func_p)() TSRMLS_DC);
+ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int 
image_type, char *tn, gdImagePtr (*func_p)(), gdImagePtr (*ioctx_func_p)());
+ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, 
char *tn, void (*func_p)());
+@@ -121,7 +172,7 @@
+ 
+ /* {{{ gd_functions[]
+  */
+-function_entry gd_functions[] = {
++zend_function_entry gd_functions[] = {
+       PHP_FE(gd_info,                                 NULL)
+       PHP_FE(imagearc,                                                        
        NULL)
+       PHP_FE(imageellipse,                                                    
NULL)
+@@ -167,6 +218,11 @@
+       PHP_FE(imagecopyresampled,                                              
NULL)
+ #endif
+ 
++#ifdef PHP_WIN32
++      PHP_FE(imagegrabwindow,                                                 
NULL)
++      PHP_FE(imagegrabscreen,                                                 
NULL)
++#endif
++
+ #ifdef HAVE_GD_BUNDLED
+       PHP_FE(imagerotate,                                                     
NULL)
+       PHP_FE(imageantialias,                                                  
NULL)
+@@ -277,6 +333,12 @@
+ #if HAVE_GD_BUNDLED
+       PHP_FE(imagelayereffect,                                                
NULL)
+       PHP_FE(imagecolormatch,                                                 
NULL)
++      PHP_FE(imagexbm,                                NULL)
++#endif
++/* gd filters */
++#ifdef HAVE_GD_BUNDLED
++      PHP_FE(imagefilter,                                                     
NULL)
++      PHP_FE(imageconvolution,                                                
NULL)
+ #endif
+ 
+       {NULL, NULL, NULL}
+@@ -288,9 +350,13 @@
+       "gd",
+       gd_functions,
+       PHP_MINIT(gd),
++#if HAVE_LIBT1 || HAVE_GD_FONTMUTEX
+       PHP_MSHUTDOWN(gd),
++#else
+       NULL,
+-#if HAVE_LIBGD20 && HAVE_GD_STRINGFT && (HAVE_GD_FONTCACHESHUTDOWN || 
HAVE_GD_FREEFONTCACHE)
++#endif
++      NULL,
++#if HAVE_LIBGD20 && HAVE_GD_STRINGFT && (HAVE_LIBFREETYPE && 
(HAVE_GD_FONTCACHESHUTDOWN || HAVE_GD_FREEFONTCACHE))
+       PHP_RSHUTDOWN(gd),
+ #else
+       NULL,
+@@ -304,6 +370,12 @@
+ ZEND_GET_MODULE(gd)
+ #endif
+ 
++/* {{{ PHP_INI_BEGIN */
++PHP_INI_BEGIN()
++      PHP_INI_ENTRY("gd.jpeg_ignore_warning", "0", PHP_INI_ALL, NULL)
++PHP_INI_END()
++/* }}} */
++      
+ /* {{{ php_free_gd_image
+  */
+ static void php_free_gd_image(zend_rsrc_list_entry *rsrc TSRMLS_DC)
+@@ -326,15 +398,21 @@
+ }
+ /* }}} */
+ 
++
+ /* {{{ PHP_MSHUTDOWN_FUNCTION
+  */
++#if HAVE_LIBT1 || HAVE_GD_FONTMUTEX
+ PHP_MSHUTDOWN_FUNCTION(gd)
+ {
  #if HAVE_LIBT1
        T1_CloseLib();
  #endif
-+#if HAVE_GD_FONTMUTEX
-+    gdFontCacheMutexShutdown();
++#if HAVE_GD_FONTMUTEX && HAVE_LIBFREETYPE
++      gdFontCacheMutexShutdown();
 +#endif
        return SUCCESS;
  }
++#endif
  /* }}} */
-@@ -344,6 +347,9 @@
+ 
+ 
+@@ -344,6 +422,10 @@
  {
        le_gd = zend_register_list_destructors_ex(php_free_gd_image, NULL, 
"gd", module_number);
        le_gd_font = zend_register_list_destructors_ex(php_free_gd_font, NULL, 
"gd font", module_number);
-+#if HAVE_GD_FONTMUTEX
-+    gdFontCacheMutexSetup();
++
++#if HAVE_GD_FONTMUTEX && HAVE_LIBFREETYPE
++      gdFontCacheMutexSetup();
 +#endif
  #if HAVE_LIBT1
        T1_SetBitmapPad(8);
        T1_InitLib(NO_LOGFILE | IGNORE_CONFIGFILE | IGNORE_FONTDATABASE);
-@@ -1146,7 +1152,7 @@
- 
-       convert_to_double_ex(ANGLE);
-       degrees = Z_DVAL_PP(ANGLE);
--      im_dst = gdImageRotate(im_src, degrees, color);
-+      im_dst = gdImageRotate(im_src, degrees, color, 0);
- 
-       if (im_dst != NULL) {
-               ZEND_REGISTER_RESOURCE(return_value, im_dst, le_gd);
-@@ -3775,7 +3781,11 @@
+@@ -352,6 +434,8 @@
+       le_ps_enc = zend_register_list_destructors_ex(php_free_ps_enc, NULL, 
"gd PS encoding", module_number);
+ #endif
  
- #ifdef HAVE_GD_JPG
-               case PHP_GDIMG_TYPE_JPG:
-+#ifdef HAVE_GD_BUNDLED
-+                      im_org = gdImageCreateFromJpeg(org, 0);
-+#else
-                       im_org = gdImageCreateFromJpeg(org);
-+#endif
-                       if (im_org == NULL) {
-                               php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Unable to open '%s' Not a valid JPEG file", fn_dest);
-                               RETURN_FALSE;
-diff -urN php-4.4.7.org/ext/gd/libgd/gd_arc_f_buggy.c 
php-4.4.7/ext/gd/libgd/gd_arc_f_buggy.c
---- php-4.4.7.org/ext/gd/libgd/gd_arc_f_buggy.c        2003-03-05 
17:04:20.000000000 +0100
-+++ php-4.4.7/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.7.org/ext/gd/libgd/gd.c php-4.4.7/ext/gd/libgd/gd.c
---- php-4.4.7.org/ext/gd/libgd/gd.c    2007-04-14 19:38:38.000000000 +0200
-+++ php-4.4.7/ext/gd/libgd/gd.c        2007-04-14 19:33:15.000000000 +0200
-@@ -1,4 +1,4 @@
--#include <stdio.h>
++      REGISTER_INI_ENTRIES();
++      
+       REGISTER_LONG_CONSTANT("IMG_GIF", 1, CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("IMG_JPG", 2, CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("IMG_JPEG", 2, CONST_CS | CONST_PERSISTENT);
+@@ -387,16 +471,58 @@
+       REGISTER_LONG_CONSTANT("IMG_EFFECT_NORMAL", gdEffectNormal, CONST_CS | 
CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("IMG_EFFECT_OVERLAY", gdEffectOverlay, CONST_CS 
| CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("GD_BUNDLED", 1, CONST_CS | CONST_PERSISTENT);
++
++      /* Section Filters */
++      REGISTER_LONG_CONSTANT("IMG_FILTER_NEGATE", IMAGE_FILTER_NEGATE, 
CONST_CS | CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("IMG_FILTER_GRAYSCALE", IMAGE_FILTER_GRAYSCALE, 
CONST_CS | CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("IMG_FILTER_BRIGHTNESS", 
IMAGE_FILTER_BRIGHTNESS, CONST_CS | CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("IMG_FILTER_CONTRAST", IMAGE_FILTER_CONTRAST, 
CONST_CS | CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("IMG_FILTER_COLORIZE", IMAGE_FILTER_COLORIZE, 
CONST_CS | CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("IMG_FILTER_EDGEDETECT", 
IMAGE_FILTER_EDGEDETECT, CONST_CS | CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("IMG_FILTER_GAUSSIAN_BLUR", 
IMAGE_FILTER_GAUSSIAN_BLUR, CONST_CS | CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("IMG_FILTER_SELECTIVE_BLUR", 
IMAGE_FILTER_SELECTIVE_BLUR, CONST_CS | CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("IMG_FILTER_EMBOSS", IMAGE_FILTER_EMBOSS, 
CONST_CS | CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("IMG_FILTER_MEAN_REMOVAL", 
IMAGE_FILTER_MEAN_REMOVAL, CONST_CS | CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("IMG_FILTER_SMOOTH", IMAGE_FILTER_SMOOTH, 
CONST_CS | CONST_PERSISTENT);
++      /* End Section Filters */
+ #else
+       REGISTER_LONG_CONSTANT("GD_BUNDLED", 0, CONST_CS | CONST_PERSISTENT);
+ #endif
 +
- #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;
--      
++#ifdef GD_VERSION_STRING
++      REGISTER_STRING_CONSTANT("GD_VERSION", GD_VERSION_STRING, CONST_CS | 
CONST_PERSISTENT);
++#endif
 +
-       TSRMLS_FETCH();
--      
++#if defined(GD_MAJOR_VERSION) && defined(GD_MINOR_VERSION) && 
defined(GD_RELEASE_VERSION) && defined(GD_EXTRA_VERSION)
++      REGISTER_LONG_CONSTANT("GD_MAJOR_VERSION", GD_MAJOR_VERSION, CONST_CS | 
CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("GD_MINOR_VERSION", GD_MINOR_VERSION, CONST_CS | 
CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("GD_RELEASE_VERSION", GD_RELEASE_VERSION, 
CONST_CS | CONST_PERSISTENT);
++      REGISTER_STRING_CONSTANT("GD_EXTRA_VERSION", GD_EXTRA_VERSION, CONST_CS 
| CONST_PERSISTENT);
++#endif
 +
-       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();
--      
++#ifdef HAVE_GD_PNG
 +
-       va_start(args, format);
-       php_verror(NULL, "", E_WARNING, format, args TSRMLS_CC);
-       va_end(args);
-@@ -125,8 +123,8 @@
-       im = (gdImage *) gdMalloc(sizeof(gdImage));
-       memset(im, 0, 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;
-@@ -166,8 +164,8 @@
-       gdImagePtr im;
-       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 +265,8 @@
++/*
++ * cannot include #include "png.h"
++ * /usr/include/pngconf.h:310:2: error: #error png.h already includes 
setjmp.h with some additional fixup.
++ * as error, use the values for now...
++ */
++      REGISTER_LONG_CONSTANT("PNG_NO_FILTER",         0x00, CONST_CS | 
CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("PNG_FILTER_NONE",       0x08, CONST_CS | 
CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("PNG_FILTER_SUB",        0x10, CONST_CS | 
CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("PNG_FILTER_UP",         0x20, CONST_CS | 
CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("PNG_FILTER_AVG",        0x40, CONST_CS | 
CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("PNG_FILTER_PAETH",      0x80, CONST_CS | 
CONST_PERSISTENT);
++      REGISTER_LONG_CONSTANT("PNG_ALL_FILTERS",       0x08 | 0x10 | 0x20 | 
0x40 | 0x80, CONST_CS | CONST_PERSISTENT);
++#endif
+       return SUCCESS;
  }
+ /* }}} */
  
- /* 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.
+ /* {{{ PHP_RSHUTDOWN_FUNCTION
   */
+-#if HAVE_LIBGD20 && HAVE_GD_STRINGFT && (HAVE_GD_FONTCACHESHUTDOWN || 
HAVE_GD_FREEFONTCACHE)
++#if HAVE_LIBGD20 && HAVE_GD_STRINGFT && (HAVE_LIBFREETYPE && 
(HAVE_GD_FONTCACHESHUTDOWN || HAVE_GD_FREEFONTCACHE))
+ PHP_RSHUTDOWN_FUNCTION(gd)
+ {
+ #if HAVE_GD_FONTCACHESHUTDOWN
+@@ -410,7 +536,7 @@
+ /* }}} */
  
- #define RETURN_HWB(h, w, b) {HWB->H = h; HWB->W = w; HWB->B = b; return HWB;}
-@@ -287,8 +285,8 @@
+ #if HAVE_GD_BUNDLED
+-#define PHP_GD_VERSION_STRING "bundled (2.0.28 compatible)"
++#define PHP_GD_VERSION_STRING "bundled (2.0.34 compatible)"
+ #elif HAVE_LIBGD20
+ #define PHP_GD_VERSION_STRING "2.0 or higher"
+ #elif HAVE_GDIMAGECOLORRESOLVE
+@@ -436,8 +562,24 @@
+       php_info_print_table_row(2, "FreeType Support", "enabled");
+ #if HAVE_LIBFREETYPE
+       php_info_print_table_row(2, "FreeType Linkage", "with freetype");
++      {
++              char tmp[256];
++#ifdef FREETYPE_PATCH
++              snprintf(tmp, sizeof(tmp), "%d.%d.%d", FREETYPE_MAJOR, 
FREETYPE_MINOR, FREETYPE_PATCH);
++#elif defined(FREETYPE_MAJOR)
++              snprintf(tmp, sizeof(tmp), "%d.%d", FREETYPE_MAJOR, 
FREETYPE_MINOR);
++#else
++              snprintf(tmp, sizeof(tmp), "1.x");
++#endif
++              php_info_print_table_row(2, "FreeType Version", tmp);
++      }
+ #elif HAVE_LIBTTF
+       php_info_print_table_row(2, "FreeType Linkage", "with TTF library");
++      {
++              char tmp[256];
++              snprintf(tmp, sizeof(tmp), "%d.%d", TT_FREETYPE_MAJOR, 
TT_FREETYPE_MINOR);
++              php_info_print_table_row(2, "FreeType Version", tmp);
++      }
+ #else
+       php_info_print_table_row(2, "FreeType Linkage", "with unknown library");
+ #endif
+@@ -464,6 +606,9 @@
+ #ifdef HAVE_GD_WBMP
+       php_info_print_table_row(2, "WBMP Support", "enabled");
+ #endif
++#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED)
++      php_info_print_table_row(2, "XPM Support", "enabled");
++#endif
+ #ifdef HAVE_GD_XBM
+       php_info_print_table_row(2, "XBM Support", "enabled");
+ #endif
+@@ -530,6 +675,11 @@
+ #else
+       add_assoc_bool(return_value, "WBMP Support", 0);
+ #endif
++#if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED)
++      add_assoc_bool(return_value, "XPM Support", 1);
++#else
++      add_assoc_bool(return_value, "XPM Support", 0);
++#endif
+ #ifdef HAVE_GD_XBM
+       add_assoc_bool(return_value, "XBM Support", 1);
+ #else
+@@ -548,6 +698,7 @@
+ {
+       return le_gd;
+ }
++/* }}} */
  
+ #ifndef HAVE_GDIMAGECOLORRESOLVE
  
- /*
-- * 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 +303,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.
-        */
+@@ -763,13 +914,19 @@
+       convert_to_long_ex(x_size);
+       convert_to_long_ex(y_size);
  
-       float R = RGB.R, G = RGB.G, B = RGB.B, w, v, b, f;
-@@ -320,7 +318,7 @@
+-      if (Z_LVAL_PP(x_size) <= 0 || Z_LVAL_PP(y_size) <= 0) {
++      if (Z_LVAL_PP(x_size) <= 0 || Z_LVAL_PP(y_size) <= 0 ||
++                      Z_LVAL_PP(x_size) >= INT_MAX || Z_LVAL_PP(y_size) >= 
INT_MAX 
++              ) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid image 
dimensions");
+               RETURN_FALSE;
        }
-       f = (R == w) ? G - B : ((G == w) ? B - R : R - G);
-       i = (R == w) ? 3 : ((G == w) ? 5 : 1);
--      
+ 
+       im = gdImageCreateTrueColor(Z_LVAL_PP(x_size), Z_LVAL_PP(y_size));
+ 
++      if (!im) {
++              RETURN_FALSE;
++      }
 +
-       RETURN_HWB(i - f / (v - w), w, b);
+       ZEND_REGISTER_RESOURCE(return_value, im, le_gd);
  }
+ /* }}} */
+@@ -836,15 +993,19 @@
+       result = gdImageColorMatch(im1, im2);
+       switch (result) {
+               case -1:
+-                      php_error_docref(NULL TSRMLS_CC, E_ERROR, "Image1 must 
be TrueColor" );
++                      php_error_docref(NULL TSRMLS_CC, E_WARNING, "Image1 
must be TrueColor" );
+                       RETURN_FALSE;
+                       break;
+               case -2:
+-                      php_error_docref(NULL TSRMLS_CC, E_ERROR, "Image2 must 
be Palette" );
++                      php_error_docref(NULL TSRMLS_CC, E_WARNING, "Image2 
must be Palette" );
+                       RETURN_FALSE;
+                       break;
+               case -3:
+-                      php_error_docref(NULL TSRMLS_CC, E_ERROR, "Image1 and 
Image2 must be the same size" );
++                      php_error_docref(NULL TSRMLS_CC, E_WARNING, "Image1 and 
Image2 must be the same size" );
++                      RETURN_FALSE;
++                      break;
++              case -4:
++                      php_error_docref(NULL TSRMLS_CC, E_WARNING, "Image2 
must have at least one color" );
+                       RETURN_FALSE;
+                       break;
+       }
+@@ -977,6 +1138,7 @@
  
-@@ -363,9 +361,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;
<<Diff was trimmed, longer than 597 lines>>

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

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to