| 1 |
From: Matthias Klose <[email protected]> |
| 2 |
Subject: modification to source code |
| 3 |
|
| 4 |
--- a/src/gifSave.cpp |
| 5 |
+++ b/src/gifSave.cpp |
| 6 |
@@ -63,10 +63,10 @@ |
| 7 |
b[i]=data[j++]; |
| 8 |
} |
| 9 |
|
| 10 |
|
| 11 |
+ outputPalette = GifMakeMapObject(paletteSize, NULL); |
| 12 |
if (!outputPalette) return false; |
| 13 |
|
| 14 |
|
| 15 |
+ if (GifQuantizeBuffer(sx, sy, &paletteSize, |
| 16 |
&(r[0]),&(g[0]),&(b[0]), &(output[0]), |
| 17 |
outputPalette->Colors) == GIF_ERROR) return false; |
| 18 |
|
| 19 |
@@ -114,7 +114,10 @@ |
| 20 |
unsigned char nsle[12] = "NETSCAPE2.0"; |
| 21 |
unsigned char subblock[3]; |
| 22 |
//if (EGifPutExtension(gf, 0xFF, 11, nsle) == GIF_ERROR) { |
| 23 |
|
| 24 |
+ if (EGifPutExtensionLeader(gf, APPLICATION_EXT_FUNC_CODE) == GIF_ERROR) { |
| 25 |
+ return false; |
| 26 |
+ } |
| 27 |
+ if (EGifPutExtensionBlock(gf, 11, nsle) == GIF_ERROR) { |
| 28 |
//gif_push_error(); |
| 29 |
//i_push_error(0, "writing loop extension"); |
| 30 |
return false; |
| 31 |
@@ -123,7 +126,7 @@ |
| 32 |
subblock[2] = loop_count % 256; |
| 33 |
subblock[1] = loop_count / 256; |
| 34 |
//if (EGifPutExtension(gf, 0, 3, subblock) == GIF_ERROR) { |
| 35 |
|
| 36 |
+ if (EGifPutExtensionTrailer(gf) == GIF_ERROR) { |
| 37 |
//gif_push_error(); |
| 38 |
//i_push_error(0, "writing loop extention sub-block"); |
| 39 |
return false; |
| 40 |
@@ -144,7 +147,7 @@ |
| 41 |
if (frames.size()==0) return false; |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
+ GifFileType *GifFile = EGifOpenFileName(filename, 0, NULL); |
| 46 |
|
| 47 |
if (!GifFile) return false; |
| 48 |
|
| 49 |
@@ -172,7 +175,7 @@ |
| 50 |
|
| 51 |
if (EGifPutImageDesc( |
| 52 |
GifFile, |
| 53 |
|
| 54 |
+ 0, 0, gifsx, gifsy, 0, NULL |
| 55 |
) == GIF_ERROR) return false; |
| 56 |
|
| 57 |
|
| 58 |
@@ -181,7 +184,7 @@ |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
|
| 63 |
+ if (EGifCloseFile(GifFile, NULL) == GIF_ERROR) return false; |
| 64 |
|
| 65 |
mode_t mask = umask(0); |
| 66 |
umask(mask); |