cvs: gd(GD_2_0) /libgd gd_gif_in.c
[email protected] ("Pierre-Alain Joye")
| Newsgroups | php.gd.cvs |
|---|---|
| Message-ID | <cvspajoye1175351206@cvsserver> |
pajoye Sat Mar 31 14:26:46 2007 UTC
Modified files: (Branch: GD_2_0)
/gd/libgd gd_gif_in.c
Log:
- #52, #60
- local Pallette are read twice
- Use the local dimension when available
- Rely on the global dimension when the local dimension are invalid and
the format is GIF87 (no animation)
NB: The #52 TS patch must be applied first
http://cvs.php.net/viewvc.cgi/gd/libgd/gd_gif_in.c?r1=1.5.2.3&r2=1.5.2.4&diff_format=u
Index: gd/libgd/gd_gif_in.c
diff -u gd/libgd/gd_gif_in.c:1.5.2.3 gd/libgd/gd_gif_in.c:1.5.2.4
--- gd/libgd/gd_gif_in.c:1.5.2.3 Thu Mar 8 19:56:38 2007
+++ gd/libgd/gd_gif_in.c Sat Mar 31 14:26:46 2007
@@ -128,8 +128,8 @@
unsigned char c;
unsigned char ColorMap[3][MAXCOLORMAPSIZE];
unsigned char localColorMap[3][MAXCOLORMAPSIZE];
- int imw, imh;
- int useGlobalColormap;
+ int imw, imh, screen_width, screen_height;
+ int gif87a, useGlobalColormap;
int bitPixel;
int i;
/*1.4//int imageCount = 0; */
@@ -143,21 +143,26 @@
if (strncmp((char *)buf,"GIF",3) != 0) {
return 0;
}
+ if (strncmp((char *)buf+3, "87a", 3) != 0) {
+ gif87a = 1;
+ } else if (strncmp((char *)buf+3, "89a", 3) != 0) {
+ gif87a = 0;
+ } else {
+ return 0;
+ }
+
+ if (! ReadOK(fd,buf,7)) {
+ return 0;
+ }
- if ((strncmp((char *)buf+3, "87a", 3) != 0) && (strncmp((char *)buf+3, "89a", 3) != 0)) {
- return 0;
- }
- if (! ReadOK(fd,buf,7)) {
- return 0;
- }
BitPixel = 2<<(buf[4]&0x07);
#if 0
ColorResolution = (int) (((buf[4]&0x70)>>3)+1);
Background = buf[5];
AspectRatio = buf[6];
#endif
- imw = LM_to_uint(buf[0],buf[1]);
- imh = LM_to_uint(buf[2],buf[3]);
+ screen_width = imw = LM_to_uint(buf[0],buf[1]);
+ screen_height = imh = LM_to_uint(buf[2],buf[3]);
if (BitSet(buf[4], LOCALCOLORMAP)) { /* Global Colormap */
if (ReadColorMap(fd, BitPixel, ColorMap)) {
@@ -194,12 +199,13 @@
bitPixel = 1<<((buf[8]&0x07)+1);
-
- if (!useGlobalColormap) {
- if (ReadColorMap(fd, bitPixel, localColorMap)) {
- return 0;
- }
- }
+ if (gif87a == 1) {
+ imw = screen_width;
+ imh = screen_height;
+ } else {
+ imw = LM_to_uint(buf[4],buf[5]);
+ imh = LM_to_uint(buf[6],buf[7]);
+ }
if (!(im = gdImageCreate(imw, imh))) {
return 0;