Home  |  Linux  | Mysql  | PHP  | XML
From:Takeshi Abe Date:Thu Aug 14 04:48:29 2008
Subject:cvs: gd(GD_2_0) /libgd/src gdxpm.c /libgd/src/tests CMakeLists.txt Makefile.am /libgd/src/tests/xpm CMakeLists.txt Makefile.am bug00166.c
bug00166.xpm
tabe		Thu Aug 14 10:48:29 2008 UTC

  Added files:                 (Branch: GD_2_0)
    /gd/libgd/src/tests/xpm	CMakeLists.txt Makefile.am bug00166.c 
                           	bug00166.xpm 

  Modified files:              
    /gd/libgd/src	gdxpm.c 
    /gd/libgd/src/tests	CMakeLists.txt Makefile.am 
  Log:
  fixed FS#166: 
  * added test subdirectory 'xpm'
  
  
http://cvs.php.net/viewvc.cgi/gd/libgd/src/gdxpm.c?r1=1.9&r2=1.9.2.1&diff_format=u
Index: gd/libgd/src/gdxpm.c
diff -u gd/libgd/src/gdxpm.c:1.9 gd/libgd/src/gdxpm.c:1.9.2.1
--- gd/libgd/src/gdxpm.c:1.9	Thu Jan  4 01:24:00 2007
+++ gd/libgd/src/gdxpm.c	Thu Aug 14 10:48:29 2008
@@ -31,7 +31,7 @@
 {
   XpmInfo info;
   XpmImage image;
-  int i, j, k, number;
+  int i, j, k, number, len;
   char buf[5];
   gdImagePtr im = 0;
   int *pointer;
@@ -43,9 +43,6 @@
   if (ret != XpmSuccess)
     return 0;
 
-  if (!(im = gdImageCreate (image.width, image.height)))
-    return 0;
-
   number = image.ncolors;
 	if (overflow2(sizeof (int), number)) {
 		return 0;
@@ -53,19 +50,33 @@
   colors = (int *) gdMalloc (sizeof (int) * number);
   if (colors == NULL)
     return (0);
+
+  if (!(im = gdImageCreate (image.width, image.height))) {
+    gdFree(colors);
+    return 0;
+  }
+
   for (i = 0; i < number; i++)
     {
-      switch (strlen (image.colorTable[i].c_color))
+      if(strcmp(image.colorTable[i].c_color, "None") == 0) {
+        colors[i] = gdImageGetTransparent(im);
+        if(colors[i] == -1) colors[i] = gdImageColorAllocate(im, 0, 0, 0);
+        if(colors[i] != -1) gdImageColorTransparent(im, colors[i]);
+        continue;
+      }
+      len = strlen(image.colorTable[i].c_color);
+      if(len < 1 || image.colorTable[i].c_color[0] != '#') continue;
+      switch (len)
 	{
 	case 4:
-	  buf[1] = '\0';
-	  buf[0] = image.colorTable[i].c_color[1];
+	  buf[2] = '\0';
+	  buf[0] = buf[1] = image.colorTable[i].c_color[1];
 	  red = strtol (buf, NULL, 16);
 
-	  buf[0] = image.colorTable[i].c_color[3];
+	  buf[0] = buf[1] = image.colorTable[i].c_color[2];
 	  green = strtol (buf, NULL, 16);
 
-	  buf[0] = image.colorTable[i].c_color[5];
+	  buf[0] = buf[1] = image.colorTable[i].c_color[3];
 	  blue = strtol (buf, NULL, 16);
 	  break;
 	case 7:
http://cvs.php.net/viewvc.cgi/gd/libgd/src/tests/CMakeLists.txt?r1=1.1.2.4&r2=1.1.2.5&diff_format=u
Index: gd/libgd/src/tests/CMakeLists.txt
diff -u gd/libgd/src/tests/CMakeLists.txt:1.1.2.4 gd/libgd/src/tests/CMakeLists.txt:1.1.2.5
--- gd/libgd/src/tests/CMakeLists.txt:1.1.2.4	Wed Nov 21 09:00:30 2007
+++ gd/libgd/src/tests/CMakeLists.txt	Thu Aug 14 10:48:29 2008
@@ -49,6 +49,7 @@
 		gdimagefill
 		gdimagefilltoborder
 		freetype
+		xpm
 	)
 
 	FOREACH(test_dir ${TESTS_DIRS})
http://cvs.php.net/viewvc.cgi/gd/libgd/src/tests/Makefile.am?r1=1.1.2.1&r2=1.1.2.2&diff_format=u
Index: gd/libgd/src/tests/Makefile.am
diff -u gd/libgd/src/tests/Makefile.am:1.1.2.1 gd/libgd/src/tests/Makefile.am:1.1.2.2
--- gd/libgd/src/tests/Makefile.am:1.1.2.1	Mon Mar 10 12:33:34 2008
+++ gd/libgd/src/tests/Makefile.am	Thu Aug 14 10:48:29 2008
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in -*-Makefile-*-
 AUTOMAKE_OPTIONS = foreign 1.7
 
-SUBDIRS = gd2 gdimagecolordeallocate gdimagecolortransparent gdimagefill gdimagefilltoborder gdtest jpeg gdimagearc gdimagecolorexact gdimagecopy gdimagefilledellipse gdimageline gdtiled freetype gdimagecolorclosest gdimagecolorresolve gdimagecopyrotated gdimagefilledrectangle gdimagerectangle gif png
+SUBDIRS = gd2 gdimagecolordeallocate gdimagecolortransparent gdimagefill gdimagefilltoborder gdtest jpeg gdimagearc gdimagecolorexact gdimagecopy gdimagefilledellipse gdimageline gdtiled freetype gdimagecolorclosest gdimagecolorresolve gdimagecopyrotated gdimagefilledrectangle gdimagerectangle gif png xpm
 
 EXTRA_DIST = CMakeLists.txt
 

http://cvs.php.net/viewvc.cgi/gd/libgd/src/tests/xpm/CMakeLists.txt?view=markup&rev=1.1
Index: gd/libgd/src/tests/xpm/CMakeLists.txt
+++ gd/libgd/src/tests/xpm/CMakeLists.txt

http://cvs.php.net/viewvc.cgi/gd/libgd/src/tests/xpm/Makefile.am?view=markup&rev=1.1
Index: gd/libgd/src/tests/xpm/Makefile.am
+++ gd/libgd/src/tests/xpm/Makefile.am

http://cvs.php.net/viewvc.cgi/gd/libgd/src/tests/xpm/bug00166.c?view=markup&rev=1.1
Index: gd/libgd/src/tests/xpm/bug00166.c
+++ gd/libgd/src/tests/xpm/bug00166.c

http://cvs.php.net/viewvc.cgi/gd/libgd/src/tests/xpm/bug00166.xpm?view=markup&rev=1.1
Index: gd/libgd/src/tests/xpm/bug00166.xpm
+++ gd/libgd/src/tests/xpm/bug00166.xpm


Navigate in group php.gd.cvs at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants