diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2013-12-27 22:55:15 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2013-12-27 22:55:15 +0000 |
commit | a036fbefd148edf0bacf6eb580af8ef31974194f (patch) | |
tree | 772646aad4aaf36b2f372862c731e798043ac04b /x11-misc | |
parent | stub out the treelang info page in older gcc builds #496224 by Adam Randall (diff) | |
download | historical-a036fbefd148edf0bacf6eb580af8ef31974194f.tar.gz historical-a036fbefd148edf0bacf6eb580af8ef31974194f.tar.bz2 historical-a036fbefd148edf0bacf6eb580af8ef31974194f.zip |
Bug #488406: newer giflib compile fixes.
Package-Manager: portage-2.2.7/cvs/Linux x86_64
Diffstat (limited to 'x11-misc')
-rw-r--r-- | x11-misc/xplanet/ChangeLog | 8 | ||||
-rw-r--r-- | x11-misc/xplanet/Manifest | 13 | ||||
-rw-r--r-- | x11-misc/xplanet/files/xplanet-1.3.0-giflib.patch | 741 | ||||
-rw-r--r-- | x11-misc/xplanet/xplanet-1.3.0.ebuild | 8 |
4 files changed, 759 insertions, 11 deletions
diff --git a/x11-misc/xplanet/ChangeLog b/x11-misc/xplanet/ChangeLog index 886f67a4c7bc..cce110df0e48 100644 --- a/x11-misc/xplanet/ChangeLog +++ b/x11-misc/xplanet/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for x11-misc/xplanet -# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/x11-misc/xplanet/ChangeLog,v 1.79 2012/07/03 16:42:53 ranger Exp $ +# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/x11-misc/xplanet/ChangeLog,v 1.80 2013/12/27 22:55:08 robbat2 Exp $ + + 27 Dec 2013; Robin H. Johnson <robbat2@gentoo.org> + +files/xplanet-1.3.0-giflib.patch, xplanet-1.3.0.ebuild: + Bug #488406: newer giflib compile fixes. 03 Jul 2012; Brent Baude <ranger@gentoo.org> xplanet-1.3.0.ebuild: Marking xplanet-1.3.0 ppc for bug 422393 diff --git a/x11-misc/xplanet/Manifest b/x11-misc/xplanet/Manifest index 570838b27433..ad2dd45a55dd 100644 --- a/x11-misc/xplanet/Manifest +++ b/x11-misc/xplanet/Manifest @@ -1,6 +1,7 @@ -DIST xplanet-1.2.2.tar.gz 1217169 RMD160 431c9223b2b122599a8c4bdca18c17fea0dcd5ab SHA1 3c9cc4be7cd87121884162204eff376af2fc03e3 SHA256 6f8f8c59b4d5d1dd5018ed4b1367e55f6296f0253596b7705f714a9b3ccdd3ca -DIST xplanet-1.3.0.tar.gz 1227385 RMD160 b5ba6239019669668aeb7f63391aa850cc3dd8b7 SHA1 7c5208b501b441a0184cbb334a5658d0309d7dac SHA256 44fb742bb93e5661ea8b11ccabcc12896693e051f3dd5083c9227224c416b442 -EBUILD xplanet-1.2.2.ebuild 1567 RMD160 da9efd76d185b06318477437dae67f34f5143005 SHA1 14189609ec0332da135678625bb98f27322baa35 SHA256 9bbb608a8ffd8a77d26472b756826ab2fff4aadfae433c19a6131c07c6206356 -EBUILD xplanet-1.3.0.ebuild 1675 RMD160 a088f92e6bd59d45573aef15f73ef58010534545 SHA1 6079d3697fb5a380d78e7339bfd82d3fd3dece56 SHA256 c70ae12b7e0ec420406352d787dde8ae17ee716237a95d939a2a3af1fcb8cb36 -MISC ChangeLog 10291 RMD160 a0c2d7ee15349dc1ab11215acf3e7b0a31b645a8 SHA1 c870bc3794cb153ee47d8d873196ac55249572ab SHA256 0cfe8e926f3880c882ca5e0e9e7245f64fa51b758435f69b275f62921278eaba -MISC metadata.xml 166 RMD160 7b80226659bf40e97050b1ffce1858d5f20b3c60 SHA1 e6c6436c304a65b4a012a5b7be7ee264b228a645 SHA256 8e7de0a7f7c15840474de373a3ce36adcc5dd658b2e4d18366fcb63b964a0826 +AUX xplanet-1.3.0-giflib.patch 25824 SHA256 7ca8647cf9667008fe6453e1273b75ed7d636a05b35527c588d8dd4fca2f3a19 SHA512 6ed75916d46c26cc616901f2e4af3b4b9a62c6e4c571782abeee68650677d72d5d71a7969701332b77c646d04037b5b4dbf064edf29e9b9d272fad0e76135d28 WHIRLPOOL cca73455958bc3aa65ab8c2a2b972fa63d2ca709fe5f4a90368672d50c798d864a33363a57b012eb5b3860a2d1ed51cc9aa7993e3418b310431d2b33189bf9ce +DIST xplanet-1.2.2.tar.gz 1217169 SHA256 6f8f8c59b4d5d1dd5018ed4b1367e55f6296f0253596b7705f714a9b3ccdd3ca SHA512 1a5dbad62b79adce28239615e3a2fd00300fca085f9400f2735c5dc015f06c63e182ed0d78399324bf6049374f2c034e6026a4054f26c34e11024b956695a53f WHIRLPOOL 155f436b339e345dadabbf618d79ee6ee39ea039d51c245523e7e2fdd3c50e5148c10f25c75c1b287558ada1baf2ddbbf5a3a67deec543dcaa6239d47a6b93c1 +DIST xplanet-1.3.0.tar.gz 1227385 SHA256 44fb742bb93e5661ea8b11ccabcc12896693e051f3dd5083c9227224c416b442 SHA512 c9f0db21c457d0702f8b1fb6d632838f45e80ea45b9cade80d6ab0ae956fdca03cfeed9582548c69b349a354afc27308309656d7e06ac46bc416c3e1038f8efd WHIRLPOOL e4fe013eeef4868d28f8a53c194f54865dd4cf29137936eb609352fba4a3481e0a6db9664944cb67d9e7896b150b5e640c95136e6b9f33dc4810591316d0371a +EBUILD xplanet-1.2.2.ebuild 1567 SHA256 9bbb608a8ffd8a77d26472b756826ab2fff4aadfae433c19a6131c07c6206356 SHA512 bdafe18517bed39c3f90c4c1dce96c35349b3f06aec4dd8a1f8a4d131143f6ec0bde1c07fa6e21d2f9f1f43114f6f0ec349ba0843aefad0b426b587c03ecebc1 WHIRLPOOL e5ae6a527efe9bf970e372ed6382588025317bbef28363bf60b9c39731ab2538317eed16dc8d30b2d3435038799355363e54c042f3ef8e5dd9e5fb00996957fb +EBUILD xplanet-1.3.0.ebuild 1735 SHA256 af4f4c2eb1e1a028404c487784e2482af7ce966c0d844721a823f4da18aad46a SHA512 ae4a256a9c39e9a357ee2fe64b7a69c859e812690b8cc5f637a22084c60a1fcbd95ecfc37f9e78fbd6169ba5c8669439b4c32e541f8c03b5fa74d1afd9e70cc5 WHIRLPOOL 0ace2be8c1c68616dc2a0c7c25c243a8ccfbc47de11ae8d667790983ffe0e325874f0c6c1830a2a97fdef5558b6c66246ceea9a5a28a4790cc05175d9363ffa4 +MISC ChangeLog 10448 SHA256 9a3b33d676e02ecd779e8b978028b5769b7c929135529473347974a8aac4f339 SHA512 912b43af42a85a62f072d58d0428bb0e998c2059af656673716259bf971350e6aebccb403c8e0c304e1787e388be089a63db047e7123062311bc13abadac8a11 WHIRLPOOL 5702a8c5865b03bda2b5e293419023fbc4bdd6f747851e56b4fc3d3c378bc096c12b62058924c55613177bb74fafa2b1aa8895cdce1d67ccdacb81fb0c22c17a +MISC metadata.xml 166 SHA256 8e7de0a7f7c15840474de373a3ce36adcc5dd658b2e4d18366fcb63b964a0826 SHA512 23980b683f9a89f988407b1dcc27a4465a18912f6e6cf8e1fed46182f00c4023d4802434f36b9482121ba9ffe9bc5d6e91b5d3a4ba9067fcfd8e57799c128fe3 WHIRLPOOL 96d79ff499e108ad89b80507c2e94a09af1e8031e5e2a7f9cecb2dddbf517872361436bdb983dc580660064a62663ad63aa1fad8f49dd3758253f4e378bfd297 diff --git a/x11-misc/xplanet/files/xplanet-1.3.0-giflib.patch b/x11-misc/xplanet/files/xplanet-1.3.0-giflib.patch new file mode 100644 index 000000000000..193719ea2a3d --- /dev/null +++ b/x11-misc/xplanet/files/xplanet-1.3.0-giflib.patch @@ -0,0 +1,741 @@ +Fixes from upstream SVN, to support giflib-4.2 and giflib-5. + +Index: src/libimage/gif.c +=================================================================== +--- src/libimage/gif.c (revision 184) ++++ src/libimage/gif.c (revision 186) +@@ -20,222 +20,581 @@ + + #include <stdio.h> + #include <stdlib.h> ++#include <string.h> + + #include <gif_lib.h> + + /* +- A lot of this is based on the gif2rgb and rgb2gif codes in the libungif +- distribution. ++ Based on the gif2rgb and rgb2gif codes in the libgif distribution. + */ + + int + read_gif(const char *filename, int *width, int *height, unsigned char **rgb) + { +- int interlace_offset[] = { 0, 4, 2, 1 }; +- int interlace_jump[] = { 8, 8, 4, 2 }; +- GifColorType *colormap; +- GifFileType *infile; +- GifRecordType record_type; +- GifRowType *buffer = NULL; ++ int BackGround = 0; ++ /* The way Interlaced image should be read - offsets and ++ jumps... */ ++ int InterlacedOffset[] = { 0, 4, 2, 1 }; ++ int InterlacedJumps[] = { 8, 8, 4, 2 }; ++ ColorMapObject *ColorMap; + +- int i, j; +- int color_index; +- unsigned char *ptr = NULL; ++ int i, j, Size, Row, Col, Width, Height, ExtCode, Count; ++ GifRecordType RecordType; ++ GifByteType *Extension; ++ GifRowType *ScreenBuffer; + +- infile = DGifOpenFileName(filename); ++ GifRowType GifRow; ++ GifColorType *ColorMapEntry; ++ unsigned char *BufferP; + +- if (infile == NULL) ++ GifFileType *GifFile; ++#if GIFLIB_MAJOR >= 5 ++ GifFile = DGifOpenFileName(filename, NULL); ++#else ++ GifFile = DGifOpenFileName(filename); ++#endif ++ if (GifFile == NULL) { ++ fprintf(stderr, "Can't open GIF file %s\n", filename); ++ return(0); ++ } ++ /* (Following comment was probably written on a 286 running under DOS.) */ ++ /* Allocate the screen as vector of column of rows. We can't allocate the*/ ++ /* whole screen at once, as this broken minded CPU can allocate up to */ ++ /* 64k at a time and our image can be bigger than that: */ ++ /* Note this screen is device independent - it's the screen defined by */ ++ /* the GIF file parameters. */ ++ if ((ScreenBuffer = (GifRowType *) ++ malloc(GifFile->SHeight * sizeof(GifRowType))) == NULL) + { +- PrintGifError(); +- return(0); ++ fprintf(stderr, "Failed to allocate memory required, aborted."); ++ return(0); + } + +- do ++ Size = GifFile->SWidth * sizeof(GifPixelType);/* Size in bytes one row.*/ ++ if ((ScreenBuffer[0] = (GifRowType) malloc(Size)) == NULL) /* First row. */ + { +- if (DGifGetRecordType(infile, &record_type) == GIF_ERROR) +- { +- PrintGifError(); +- return(0); ++ fprintf(stderr, "Failed to allocate memory required, aborted."); ++ return(0); ++ } ++ ++ for (i = 0; i < GifFile->SWidth; i++) /* Set its color to BackGround. */ ++ ScreenBuffer[0][i] = GifFile->SBackGroundColor; ++ for (i = 1; i < GifFile->SHeight; i++) { ++ /* Allocate the other rows, and set their color to background too: */ ++ if ((ScreenBuffer[i] = (GifRowType) malloc(Size)) == NULL) ++ { ++ fprintf(stderr, "Failed to allocate memory required, aborted.\n"); ++ return(0); ++ } ++ ++ memcpy(ScreenBuffer[i], ScreenBuffer[0], Size); ++ } ++ ++ /* Scan the content of the GIF file and load the image(s) in: */ ++ do { ++ if (DGifGetRecordType(GifFile, &RecordType) == GIF_ERROR) { ++ fprintf(stderr, "Can't read GIF file\n"); ++ return(0); ++ } ++ switch (RecordType) { ++ case IMAGE_DESC_RECORD_TYPE: ++ if (DGifGetImageDesc(GifFile) == GIF_ERROR) { ++ return(0); ++ } ++ Row = GifFile->Image.Top; /* Image Position relative to Screen. */ ++ Col = GifFile->Image.Left; ++ Width = GifFile->Image.Width; ++ Height = GifFile->Image.Height; ++ if (GifFile->Image.Left + GifFile->Image.Width > GifFile->SWidth || ++ GifFile->Image.Top + GifFile->Image.Height > GifFile->SHeight) { ++ return(0); ++ } ++ if (GifFile->Image.Interlace) { ++ /* Need to perform 4 passes on the images: */ ++ for (Count = i = 0; i < 4; i++) ++ for (j = Row + InterlacedOffset[i]; j < Row + Height; ++ j += InterlacedJumps[i]) { ++ if (DGifGetLine(GifFile, &ScreenBuffer[j][Col], ++ Width) == GIF_ERROR) { ++ return(0); ++ } ++ } ++ } ++ else { ++ for (i = 0; i < Height; i++) { ++ if (DGifGetLine(GifFile, &ScreenBuffer[Row++][Col], ++ Width) == GIF_ERROR) { ++ return(0); ++ } ++ } ++ } ++ break; ++ case EXTENSION_RECORD_TYPE: ++ /* Skip any extension blocks in file: */ ++ if (DGifGetExtension(GifFile, &ExtCode, &Extension) == GIF_ERROR) { ++ return(0); ++ } ++ while (Extension != NULL) { ++ if (DGifGetExtensionNext(GifFile, &Extension) == GIF_ERROR) { ++ return(0); ++ } ++ } ++ break; ++ case TERMINATE_RECORD_TYPE: ++ break; ++ default: /* Should be traps by DGifGetRecordType. */ ++ break; ++ } ++ } while (RecordType != TERMINATE_RECORD_TYPE); ++ ++ /* Lets dump it - set the global variables required and do it: */ ++ BackGround = GifFile->SBackGroundColor; ++ ColorMap = (GifFile->Image.ColorMap ++ ? GifFile->Image.ColorMap ++ : GifFile->SColorMap); ++ if (ColorMap == NULL) { ++ fprintf(stderr, "Gif Image does not have a colormap\n"); ++ return(0); ++ } ++ ++ *width = GifFile->SWidth; ++ *height = GifFile->SHeight; ++ ++ rgb[0] = malloc(3 * *width * *height); ++ if (rgb[0] == NULL) ++ { ++ fprintf(stderr, "Can't allocate memory for GIF file.\n"); ++ return(0); ++ } ++ ++ BufferP = rgb[0]; ++ ++ for (i = 0; i < *height; i++) { ++ GifRow = ScreenBuffer[i]; ++ for (j = 0; j < *width; j++) { ++ ColorMapEntry = &ColorMap->Colors[GifRow[j]]; ++ *BufferP++ = ColorMapEntry->Red; ++ *BufferP++ = ColorMapEntry->Green; ++ *BufferP++ = ColorMapEntry->Blue; ++ } ++ } ++ ++ if (DGifCloseFile(GifFile) == GIF_ERROR) { ++ return(0); ++ } ++ ++ return(1); ++} ++ ++/* Make some variables global, so we could access them faster: */ ++static int ++ ExpNumOfColors = 8, ++ ColorMapSize = 256; ++ ++/****************************************************************************** ++ * Code to quantize high resolution image into lower one. You may want to ++ * peek into the following article this code is based on: ++ * "Color Image Quantization for frame buffer Display", by Paul Heckbert ++ * SIGGRAPH 1982 page 297-307. ++ ****************************************************************************** ++ * History: ++ * 5 Jan 90 - Version 1.0 by Gershon Elber. ++ *****************************************************************************/ ++ ++#define ABS(x) ((x) > 0 ? (x) : (-(x))) ++ ++#define COLOR_ARRAY_SIZE 32768 ++#define BITS_PER_PRIM_COLOR 5 ++#define MAX_PRIM_COLOR 0x1f ++ ++static int SortRGBAxis; ++ ++typedef struct QuantizedColorType { ++ GifByteType RGB[3]; ++ GifByteType NewColorIndex; ++ long Count; ++ struct QuantizedColorType *Pnext; ++} QuantizedColorType; ++ ++typedef struct NewColorMapType { ++ GifByteType RGBMin[3], RGBWidth[3]; ++ unsigned int NumEntries; /* # of QuantizedColorType in linked list below */ ++ unsigned long Count; /* Total number of pixels in all the entries */ ++ QuantizedColorType *QuantizedColors; ++} NewColorMapType; ++ ++static int SubdivColorMap(NewColorMapType * NewColorSubdiv, ++ unsigned int ColorMapSize, ++ unsigned int *NewColorMapSize); ++static int SortCmpRtn(const void *Entry1, const void *Entry2); ++ ++/****************************************************************************** ++ * Quantize high resolution image into lower one. Input image consists of a ++ * 2D array for each of the RGB colors with size Width by Height. There is no ++ * Color map for the input. Output is a quantized image with 2D array of ++ * indexes into the output color map. ++ * Note input image can be 24 bits at the most (8 for red/green/blue) and ++ * the output has 256 colors at the most (256 entries in the color map.). ++ * ColorMapSize specifies size of color map up to 256 and will be updated to ++ * real size before returning. ++ * Also non of the parameter are allocated by this routine. ++ * This function returns GIF_OK if succesfull, GIF_ERROR otherwise. ++ ******************************************************************************/ ++static int ++QuantizeBuffer(unsigned int Width, ++ unsigned int Height, ++ int *ColorMapSize, ++ GifByteType * RedInput, ++ GifByteType * GreenInput, ++ GifByteType * BlueInput, ++ GifByteType * OutputBuffer, ++ GifColorType * OutputColorMap) { ++ ++ unsigned int Index, NumOfEntries; ++ int i, j, MaxRGBError[3]; ++ unsigned int NewColorMapSize; ++ long Red, Green, Blue; ++ NewColorMapType NewColorSubdiv[256]; ++ QuantizedColorType *ColorArrayEntries, *QuantizedColor; ++ ++ ColorArrayEntries = (QuantizedColorType *)malloc( ++ sizeof(QuantizedColorType) * COLOR_ARRAY_SIZE); ++ if (ColorArrayEntries == NULL) { ++ return GIF_ERROR; ++ } ++ ++ for (i = 0; i < COLOR_ARRAY_SIZE; i++) { ++ ColorArrayEntries[i].RGB[0] = i >> (2 * BITS_PER_PRIM_COLOR); ++ ColorArrayEntries[i].RGB[1] = (i >> BITS_PER_PRIM_COLOR) & ++ MAX_PRIM_COLOR; ++ ColorArrayEntries[i].RGB[2] = i & MAX_PRIM_COLOR; ++ ColorArrayEntries[i].Count = 0; ++ } ++ ++ /* Sample the colors and their distribution: */ ++ for (i = 0; i < (int)(Width * Height); i++) { ++ Index = ((RedInput[i] >> (8 - BITS_PER_PRIM_COLOR)) << ++ (2 * BITS_PER_PRIM_COLOR)) + ++ ((GreenInput[i] >> (8 - BITS_PER_PRIM_COLOR)) << ++ BITS_PER_PRIM_COLOR) + ++ (BlueInput[i] >> (8 - BITS_PER_PRIM_COLOR)); ++ ColorArrayEntries[Index].Count++; ++ } ++ ++ /* Put all the colors in the first entry of the color map, and call the ++ * recursive subdivision process. */ ++ for (i = 0; i < 256; i++) { ++ NewColorSubdiv[i].QuantizedColors = NULL; ++ NewColorSubdiv[i].Count = NewColorSubdiv[i].NumEntries = 0; ++ for (j = 0; j < 3; j++) { ++ NewColorSubdiv[i].RGBMin[j] = 0; ++ NewColorSubdiv[i].RGBWidth[j] = 255; + } ++ } + +- switch (record_type) +- { +- case IMAGE_DESC_RECORD_TYPE: +- if (DGifGetImageDesc(infile) == GIF_ERROR) +- { +- PrintGifError(); +- return(0); ++ /* Find the non empty entries in the color table and chain them: */ ++ for (i = 0; i < COLOR_ARRAY_SIZE; i++) ++ if (ColorArrayEntries[i].Count > 0) ++ break; ++ QuantizedColor = NewColorSubdiv[0].QuantizedColors = &ColorArrayEntries[i]; ++ NumOfEntries = 1; ++ while (++i < COLOR_ARRAY_SIZE) ++ if (ColorArrayEntries[i].Count > 0) { ++ QuantizedColor->Pnext = &ColorArrayEntries[i]; ++ QuantizedColor = &ColorArrayEntries[i]; ++ NumOfEntries++; ++ } ++ QuantizedColor->Pnext = NULL; ++ ++ NewColorSubdiv[0].NumEntries = NumOfEntries; /* Different sampled colors */ ++ NewColorSubdiv[0].Count = ((long)Width) * Height; /* Pixels */ ++ NewColorMapSize = 1; ++ if (SubdivColorMap(NewColorSubdiv, *ColorMapSize, &NewColorMapSize) != ++ GIF_OK) { ++ free((char *)ColorArrayEntries); ++ return GIF_ERROR; ++ } ++ if (NewColorMapSize < *ColorMapSize) { ++ /* And clear rest of color map: */ ++ for (i = NewColorMapSize; i < *ColorMapSize; i++) ++ OutputColorMap[i].Red = OutputColorMap[i].Green = ++ OutputColorMap[i].Blue = 0; ++ } ++ ++ /* Average the colors in each entry to be the color to be used in the ++ * output color map, and plug it into the output color map itself. */ ++ for (i = 0; i < NewColorMapSize; i++) { ++ if ((j = NewColorSubdiv[i].NumEntries) > 0) { ++ QuantizedColor = NewColorSubdiv[i].QuantizedColors; ++ Red = Green = Blue = 0; ++ while (QuantizedColor) { ++ QuantizedColor->NewColorIndex = i; ++ Red += QuantizedColor->RGB[0]; ++ Green += QuantizedColor->RGB[1]; ++ Blue += QuantizedColor->RGB[2]; ++ QuantizedColor = QuantizedColor->Pnext; + } ++ OutputColorMap[i].Red = (Red << (8 - BITS_PER_PRIM_COLOR)) / j; ++ OutputColorMap[i].Green = (Green << (8 - BITS_PER_PRIM_COLOR)) / j; ++ OutputColorMap[i].Blue = (Blue << (8 - BITS_PER_PRIM_COLOR)) / j; ++ } else ++ fprintf(stderr, ++ "Null entry in quantized color map - that's weird.\n"); ++ } + +- *width = infile->Image.Width; +- *height = infile->Image.Height; ++ /* Finally scan the input buffer again and put the mapped index in the ++ * output buffer. */ ++ MaxRGBError[0] = MaxRGBError[1] = MaxRGBError[2] = 0; ++ for (i = 0; i < (int)(Width * Height); i++) { ++ Index = ((RedInput[i] >> (8 - BITS_PER_PRIM_COLOR)) << ++ (2 * BITS_PER_PRIM_COLOR)) + ++ ((GreenInput[i] >> (8 - BITS_PER_PRIM_COLOR)) << ++ BITS_PER_PRIM_COLOR) + ++ (BlueInput[i] >> (8 - BITS_PER_PRIM_COLOR)); ++ Index = ColorArrayEntries[Index].NewColorIndex; ++ OutputBuffer[i] = Index; ++ if (MaxRGBError[0] < ABS(OutputColorMap[Index].Red - RedInput[i])) ++ MaxRGBError[0] = ABS(OutputColorMap[Index].Red - RedInput[i]); ++ if (MaxRGBError[1] < ABS(OutputColorMap[Index].Green - GreenInput[i])) ++ MaxRGBError[1] = ABS(OutputColorMap[Index].Green - GreenInput[i]); ++ if (MaxRGBError[2] < ABS(OutputColorMap[Index].Blue - BlueInput[i])) ++ MaxRGBError[2] = ABS(OutputColorMap[Index].Blue - BlueInput[i]); ++ } + +- buffer = malloc(*height * sizeof(GifRowType *)); +- if (buffer == NULL) +- { +- fprintf(stderr, "Can't allocate memory for GIF file.\n"); +- return(0); +- } +- +- for (i = 0; i < *height; i++) +- { +- buffer[i] = malloc(*width * sizeof(GifPixelType)); +- if (buffer[i] == NULL) +- { +- fprintf(stderr, "Can't allocate memory for GIF line.\n"); +- return(0); ++ free((char *)ColorArrayEntries); ++ ++ *ColorMapSize = NewColorMapSize; ++ ++ return GIF_OK; ++} ++ ++/****************************************************************************** ++ * Routine to subdivide the RGB space recursively using median cut in each ++ * axes alternatingly until ColorMapSize different cubes exists. ++ * The biggest cube in one dimension is subdivide unless it has only one entry. ++ * Returns GIF_ERROR if failed, otherwise GIF_OK. ++ ******************************************************************************/ ++static int ++SubdivColorMap(NewColorMapType * NewColorSubdiv, ++ unsigned int ColorMapSize, ++ unsigned int *NewColorMapSize) { ++ ++ int MaxSize; ++ unsigned int i, j, Index = 0, NumEntries, MinColor, MaxColor; ++ long Sum, Count; ++ QuantizedColorType *QuantizedColor, **SortArray; ++ ++ while (ColorMapSize > *NewColorMapSize) { ++ /* Find candidate for subdivision: */ ++ MaxSize = -1; ++ for (i = 0; i < *NewColorMapSize; i++) { ++ for (j = 0; j < 3; j++) { ++ if ((((int)NewColorSubdiv[i].RGBWidth[j]) > MaxSize) && ++ (NewColorSubdiv[i].NumEntries > 1)) { ++ MaxSize = NewColorSubdiv[i].RGBWidth[j]; ++ Index = i; ++ SortRGBAxis = j; + } + } +- +- if (infile->Image.Interlace) +- { +- for (i = 0; i < 4; i++) +- for (j = interlace_offset[i]; j < *height; +- j += interlace_jump[i]) +- DGifGetLine(infile, buffer[j], *width); +- } +- else +- { +- for (i = 0; i < *height; i++) +- DGifGetLine(infile, buffer[i], *width); +- } +- break; +- case EXTENSION_RECORD_TYPE: +- { +- /* Skip extension blocks */ +- int ext_code; +- GifByteType *ext; +- if (DGifGetExtension(infile, &ext_code, &ext) == GIF_ERROR) +- { +- PrintGifError(); +- return(0); +- } +- while (ext != NULL) +- { +- if (DGifGetExtensionNext(infile, &ext) == GIF_ERROR) +- { +- PrintGifError(); +- return(0); +- } +- } + } +- break; +- case TERMINATE_RECORD_TYPE: +- break; +- default: +- fprintf(stderr, "unknown record type in GIF file\n"); +- break; +- } +- } while (record_type != TERMINATE_RECORD_TYPE); + +- colormap = (infile->Image.ColorMap ? infile->Image.ColorMap->Colors +- : infile->SColorMap->Colors); ++ if (MaxSize == -1) ++ return GIF_OK; + +- rgb[0] = malloc(3 * *width * *height); +- if (rgb[0] == NULL) +- { +- fprintf(stderr, "Can't allocate memory for GIF file.\n"); +- return(0); +- } ++ /* Split the entry Index into two along the axis SortRGBAxis: */ + +- ptr = rgb[0]; ++ /* Sort all elements in that entry along the given axis and split at ++ * the median. */ ++ SortArray = (QuantizedColorType **)malloc( ++ sizeof(QuantizedColorType *) * ++ NewColorSubdiv[Index].NumEntries); ++ if (SortArray == NULL) ++ return GIF_ERROR; ++ for (j = 0, QuantizedColor = NewColorSubdiv[Index].QuantizedColors; ++ j < NewColorSubdiv[Index].NumEntries && QuantizedColor != NULL; ++ j++, QuantizedColor = QuantizedColor->Pnext) ++ SortArray[j] = QuantizedColor; + +- for (j = 0; j < *height; j++) +- { +- for (i = 0; i < *width; i++) +- { +- color_index = (int) buffer[j][i]; +- *ptr++ = (unsigned char) colormap[color_index].Red; +- *ptr++ = (unsigned char) colormap[color_index].Green; +- *ptr++ = (unsigned char) colormap[color_index].Blue; ++ qsort(SortArray, NewColorSubdiv[Index].NumEntries, ++ sizeof(QuantizedColorType *), SortCmpRtn); ++ ++ /* Relink the sorted list into one: */ ++ for (j = 0; j < NewColorSubdiv[Index].NumEntries - 1; j++) ++ SortArray[j]->Pnext = SortArray[j + 1]; ++ SortArray[NewColorSubdiv[Index].NumEntries - 1]->Pnext = NULL; ++ NewColorSubdiv[Index].QuantizedColors = QuantizedColor = SortArray[0]; ++ free((char *)SortArray); ++ ++ /* Now simply add the Counts until we have half of the Count: */ ++ Sum = NewColorSubdiv[Index].Count / 2 - QuantizedColor->Count; ++ NumEntries = 1; ++ Count = QuantizedColor->Count; ++ while (QuantizedColor->Pnext != NULL && ++ (Sum -= QuantizedColor->Pnext->Count) >= 0 && ++ QuantizedColor->Pnext->Pnext != NULL) { ++ QuantizedColor = QuantizedColor->Pnext; ++ NumEntries++; ++ Count += QuantizedColor->Count; + } +- free(buffer[j]); ++ /* Save the values of the last color of the first half, and first ++ * of the second half so we can update the Bounding Boxes later. ++ * Also as the colors are quantized and the BBoxes are full 0..255, ++ * they need to be rescaled. ++ */ ++ MaxColor = QuantizedColor->RGB[SortRGBAxis]; /* Max. of first half */ ++ /* coverity[var_deref_op] */ ++ MinColor = QuantizedColor->Pnext->RGB[SortRGBAxis]; /* of second */ ++ MaxColor <<= (8 - BITS_PER_PRIM_COLOR); ++ MinColor <<= (8 - BITS_PER_PRIM_COLOR); ++ ++ /* Partition right here: */ ++ NewColorSubdiv[*NewColorMapSize].QuantizedColors = ++ QuantizedColor->Pnext; ++ QuantizedColor->Pnext = NULL; ++ NewColorSubdiv[*NewColorMapSize].Count = Count; ++ NewColorSubdiv[Index].Count -= Count; ++ NewColorSubdiv[*NewColorMapSize].NumEntries = ++ NewColorSubdiv[Index].NumEntries - NumEntries; ++ NewColorSubdiv[Index].NumEntries = NumEntries; ++ for (j = 0; j < 3; j++) { ++ NewColorSubdiv[*NewColorMapSize].RGBMin[j] = ++ NewColorSubdiv[Index].RGBMin[j]; ++ NewColorSubdiv[*NewColorMapSize].RGBWidth[j] = ++ NewColorSubdiv[Index].RGBWidth[j]; ++ } ++ NewColorSubdiv[*NewColorMapSize].RGBWidth[SortRGBAxis] = ++ NewColorSubdiv[*NewColorMapSize].RGBMin[SortRGBAxis] + ++ NewColorSubdiv[*NewColorMapSize].RGBWidth[SortRGBAxis] - MinColor; ++ NewColorSubdiv[*NewColorMapSize].RGBMin[SortRGBAxis] = MinColor; ++ ++ NewColorSubdiv[Index].RGBWidth[SortRGBAxis] = ++ MaxColor - NewColorSubdiv[Index].RGBMin[SortRGBAxis]; ++ ++ (*NewColorMapSize)++; + } +- +- free(buffer); + +- DGifCloseFile(infile); +- return(1); ++ return GIF_OK; + } + ++/**************************************************************************** ++ * Routine called by qsort to compare two entries. ++ ****************************************************************************/ ++static int ++SortCmpRtn(const void *Entry1, ++ const void *Entry2) { ++ ++ return (*((QuantizedColorType **) Entry1))->RGB[SortRGBAxis] - ++ (*((QuantizedColorType **) Entry2))->RGB[SortRGBAxis]; ++} ++ ++/****************************************************************************** ++* Close output file (if open), and exit. ++******************************************************************************/ ++static void QuitGifError(GifFileType *GifFile) ++{ ++ fprintf(stderr, "Error writing GIF file\n"); ++ if (GifFile != NULL) EGifCloseFile(GifFile); ++} ++ + int + write_gif(const char *filename, int width, int height, char *rgb) + { + int i; +- int colormap_size = 256; +- GifByteType *red, *green, *blue, *buffer, *ptr; +- GifFileType *outfile; +- ColorMapObject *colormap; ++ GifByteType *red, *green, *blue; + ++ GifByteType *OutputBuffer = NULL; ++ ColorMapObject *OutputColorMap = NULL; ++ ++ GifFileType *GifFile; ++ GifByteType *Ptr; ++ ++ bool GifTestExistance = false; ++ ++ ColorMapSize = 1 << ExpNumOfColors; ++ ++#if GIFLIB_MAJOR >= 5 ++ OutputColorMap = GifMakeMapObject(ColorMapSize, NULL); ++#else ++ OutputColorMap = MakeMapObject(ColorMapSize, NULL); ++#endif ++ ++ if (OutputColorMap == NULL || ++ (OutputBuffer = (GifByteType *) malloc(width * height * ++ sizeof(GifByteType))) == NULL) ++ { ++ fprintf(stderr,"Failed to allocate memory required, aborted."); ++ return(0); ++ } ++ + red = malloc(width * height * sizeof(GifByteType)); + green = malloc(width * height * sizeof(GifByteType)); + blue = malloc(width * height * sizeof(GifByteType)); +- buffer = malloc(width * height * sizeof(GifByteType)); +- +- if (red == NULL || green == NULL || blue == NULL || buffer == NULL) ++ if (red == NULL || green == NULL || blue == NULL) + { +- fprintf(stderr, "Can't allocate memory for GIF file.\n"); +- return(0); ++ fprintf(stderr, "Can't allocate memory for GIF file.\n"); ++ return(0); + } +- +- colormap = MakeMapObject(colormap_size, NULL); +- + for (i = 0; i < width * height; i++) + { +- red[i] = (GifByteType) rgb[3*i ]; +- green[i] = (GifByteType) rgb[3*i+1]; +- blue[i] = (GifByteType) rgb[3*i+2]; ++ red[i] = (GifByteType) rgb[3*i ]; ++ green[i] = (GifByteType) rgb[3*i+1]; ++ blue[i] = (GifByteType) rgb[3*i+2]; + } +- +- if (QuantizeBuffer(width, height, &colormap_size, red, green, blue, +- buffer, colormap->Colors) == GIF_ERROR) ++ ++ if (QuantizeBuffer(width, height, &ColorMapSize, ++ red, green, blue, ++ OutputBuffer, OutputColorMap->Colors) == GIF_ERROR) ++ + { +- PrintGifError(); +- return(0); ++ QuitGifError(NULL); ++ return(0); + } + + free(red); + free(green); + free(blue); + +- outfile = EGifOpenFileName((char *) filename, FALSE); +- if (outfile == NULL) ++ Ptr = OutputBuffer; ++ ++#if GIFLIB_MAJOR >= 5 ++ GifFile = EGifOpenFileName(filename, GifTestExistance, NULL); ++#else ++ GifFile = EGifOpenFileName(filename, GifTestExistance); ++#endif ++ /* Open stdout for the output file: */ ++ if (GifFile == NULL) + { +- PrintGifError(); +- return(0); ++ QuitGifError(GifFile); ++ return(0); + } + +- if (EGifPutScreenDesc(outfile, width, height, colormap_size, 0, colormap) +- == GIF_ERROR) ++ if (EGifPutScreenDesc(GifFile, ++ width, height, ExpNumOfColors, 0, ++ OutputColorMap) == GIF_ERROR || ++ EGifPutImageDesc(GifFile, ++ 0, 0, width, height, false, NULL) == GIF_ERROR) ++ + { +- PrintGifError(); +- return(0); ++ QuitGifError(GifFile); ++ return(0); + } + +- if (EGifPutImageDesc(outfile, 0, 0, width, height, FALSE, NULL) +- == GIF_ERROR) +- { +- PrintGifError(); +- return(0); ++ for (i = 0; i < height; i++) { ++ if (EGifPutLine(GifFile, Ptr, width) == GIF_ERROR) ++ ++ { ++ QuitGifError(GifFile); ++ return(0); ++ } ++ Ptr += width; + } + +- ptr = buffer; +- for (i = 0; i < height; i++) ++ if (EGifCloseFile(GifFile) == GIF_ERROR) ++ + { +- if (EGifPutLine(outfile, ptr, width) == GIF_ERROR) +- { +- PrintGifError(); +- return(0); +- } +- ptr += width; ++ QuitGifError(GifFile); ++ return(0); + } + +- EGifSpew(outfile); +- +- if (EGifCloseFile(outfile) == GIF_ERROR) +- PrintGifError(); +- +- free(buffer); +- + return(1); + } diff --git a/x11-misc/xplanet/xplanet-1.3.0.ebuild b/x11-misc/xplanet/xplanet-1.3.0.ebuild index 31db80efd9f9..61efa1aacfe8 100644 --- a/x11-misc/xplanet/xplanet-1.3.0.ebuild +++ b/x11-misc/xplanet/xplanet-1.3.0.ebuild @@ -1,9 +1,9 @@ -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/x11-misc/xplanet/xplanet-1.3.0.ebuild,v 1.5 2012/07/03 16:42:53 ranger Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-misc/xplanet/xplanet-1.3.0.ebuild,v 1.6 2013/12/27 22:55:08 robbat2 Exp $ EAPI=4 -inherit flag-o-matic +inherit base flag-o-matic DESCRIPTION="Render images of the earth into the X root window" HOMEPAGE="http://xplanet.sourceforge.net/" @@ -40,6 +40,8 @@ DEPEND="${RDEPEND} DOCS="AUTHORS ChangeLog NEWS README TODO" +PATCHES=( "${FILESDIR}"/xplanet-1.3.0-giflib.patch ) + src_configure() { # econf says 'checking pnm.h presence... no' use png && append-cppflags -I/usr/include/netpbm |