public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/dotnet:master commit in: dev-dotnet/libgdiplus/, dev-dotnet/libgdiplus/files/
@ 2013-10-11  4:18 Heather Cynede
  0 siblings, 0 replies; 6+ messages in thread
From: Heather Cynede @ 2013-10-11  4:18 UTC (permalink / raw
  To: gentoo-commits

commit:     b7870b2c91a373ffced5be7fd4b238a403f8513b
Author:     Heather <Heather <AT> cynede <DOT> net>
AuthorDate: Fri Oct 11 04:20:37 2013 +0000
Commit:     Heather Cynede <cynede <AT> gentoo <DOT> org>
CommitDate: Fri Oct 11 04:20:37 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/dotnet.git;a=commit;h=b7870b2c

bug #486320

---
 .../libgdiplus-2.10.9-giflib-quantizebuffer.patch  | 296 +++++++++++++++++++++
 dev-dotnet/libgdiplus/libgdiplus-2.10.9-r2.ebuild  |   3 +-
 2 files changed, 298 insertions(+), 1 deletion(-)

diff --git a/dev-dotnet/libgdiplus/files/libgdiplus-2.10.9-giflib-quantizebuffer.patch b/dev-dotnet/libgdiplus/files/libgdiplus-2.10.9-giflib-quantizebuffer.patch
new file mode 100644
index 0000000..f65c349
--- /dev/null
+++ b/dev-dotnet/libgdiplus/files/libgdiplus-2.10.9-giflib-quantizebuffer.patch
@@ -0,0 +1,296 @@
+diff -uNr libgdiplus-2.10.9/src/gifcodec.c libgdiplus-2.10.9-funtoo/src/gifcodec.c
+--- libgdiplus-2.10.9/src/gifcodec.c    2011-12-02 18:23:12.000000000 +0100
++++ libgdiplus-2.10.9-funtoo/src/gifcodec.c     2013-10-08 18:06:44.643554570 +0200
+@@ -39,6 +39,293 @@
+
+ #include "gifcodec.h"
+
++#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;
++
++
++/****************************************************************************
++ * 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];
++}
++
++/******************************************************************************
++ * 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 (MaxSize == -1)
++            return GIF_OK;
++
++        /* Split the entry Index into two along the axis SortRGBAxis: */
++
++        /* 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;
++
++        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;
++        }
++        /* 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)++;
++    }
++
++    return GIF_OK;
++}
++
++/******************************************************************************
++ * 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;
++        }
++    }
++
++    /* 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,
++                    "\n%s: Null entry in quantized color map - that's weird.\n",
++                    "libgdiplus");
++    }
++
++    /* 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]);
++    }
++
++#ifdef DEBUG
++    fprintf(stderr,
++            "Quantization L(0) errors: Red = %d, Green = %d, Blue = %d.\n",
++            MaxRGBError[0], MaxRGBError[1], MaxRGBError[2]);
++#endif /* DEBUG */
++
++    free((char *)ColorArrayEntries);
++
++    *ColorMapSize = NewColorMapSize;
++
++    return GIF_OK;
++}
++
+ /* giflib declares this incorrectly as EgifOpen */
+ extern GifFileType *EGifOpen(void *userData, OutputFunc writeFunc);

diff --git a/dev-dotnet/libgdiplus/libgdiplus-2.10.9-r2.ebuild b/dev-dotnet/libgdiplus/libgdiplus-2.10.9-r2.ebuild
index 21319dd..1722241 100644
--- a/dev-dotnet/libgdiplus/libgdiplus-2.10.9-r2.ebuild
+++ b/dev-dotnet/libgdiplus/libgdiplus-2.10.9-r2.ebuild
@@ -34,7 +34,8 @@ DEPEND="${RDEPEND}"
 RESTRICT="test"
 
 PATCHES=("${FILESDIR}/${P}-gold.patch"
-	"${FILESDIR}/${PN}-2.10.1-libpng15.patch" )
+	"${FILESDIR}/${PN}-2.10.1-libpng15.patch"
+	"${FILESDIR}/${PN}-2.10.9-giflib-quantizebuffer.patch")
 
 src_prepare() {
 	base_src_prepare


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/dotnet:master commit in: dev-dotnet/libgdiplus/, dev-dotnet/libgdiplus/files/
@ 2014-12-27 16:52 Heather Cynede
  0 siblings, 0 replies; 6+ messages in thread
From: Heather Cynede @ 2014-12-27 16:52 UTC (permalink / raw
  To: gentoo-commits

commit:     f4ed8f777cff373c484a0f6d93da8d8d1881d2a5
Author:     Alistair Bush <alistair.bush <AT> gmail <DOT> com>
AuthorDate: Sun Nov 30 09:37:54 2014 +0000
Commit:     Heather Cynede <cynede <AT> gentoo <DOT> org>
CommitDate: Sun Nov 30 09:37:54 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/dotnet.git;a=commit;h=f4ed8f77

update gif patch

Package-Manager: portage-2.2.14

---
 .../libgdiplus-9999-giflib-quantizebuffer.patch    | 298 +++++++++++++++++++++
 dev-dotnet/libgdiplus/libgdiplus-9999.ebuild       |   2 +-
 2 files changed, 299 insertions(+), 1 deletion(-)

diff --git a/dev-dotnet/libgdiplus/files/libgdiplus-9999-giflib-quantizebuffer.patch b/dev-dotnet/libgdiplus/files/libgdiplus-9999-giflib-quantizebuffer.patch
new file mode 100644
index 0000000..5d0b9c2
--- /dev/null
+++ b/dev-dotnet/libgdiplus/files/libgdiplus-9999-giflib-quantizebuffer.patch
@@ -0,0 +1,298 @@
+diff --git a/src/gifcodec.c b/src/gifcodec.c
+index e1a0697..e645c6e 100644
+--- a/src/gifcodec.c
++++ b/src/gifcodec.c
+@@ -39,6 +39,293 @@ GUID gdip_gif_image_format_guid = {0xb96b3cb0U, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0
+ 
+ #include "gifcodec.h"
+ 
++#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;
++
++
++/****************************************************************************
++ * 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];
++}
++
++/******************************************************************************
++ * 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 (MaxSize == -1)
++            return GIF_OK;
++
++        /* Split the entry Index into two along the axis SortRGBAxis: */
++
++        /* 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;
++
++        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;
++        }
++        /* 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)++;
++    }
++
++    return GIF_OK;
++}
++
++/******************************************************************************
++ * 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;
++        }
++    }
++
++    /* 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,
++                    "\n%s: Null entry in quantized color map - that's weird.\n",
++                    "libgdiplus");
++    }
++
++    /* 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]);
++    }
++
++#ifdef DEBUG
++    fprintf(stderr,
++            "Quantization L(0) errors: Red = %d, Green = %d, Blue = %d.\n",
++            MaxRGBError[0], MaxRGBError[1], MaxRGBError[2]);
++#endif /* DEBUG */
++
++    free((char *)ColorArrayEntries);
++
++    *ColorMapSize = NewColorMapSize;
++
++    return GIF_OK;
++}
++
+ #ifdef EgifOpen
+ /* giflib declares this incorrectly as EgifOpen */
+ extern GifFileType *EGifOpen(void *userData, OutputFunc writeFunc);

diff --git a/dev-dotnet/libgdiplus/libgdiplus-9999.ebuild b/dev-dotnet/libgdiplus/libgdiplus-9999.ebuild
index 6d3e368..c154beb 100644
--- a/dev-dotnet/libgdiplus/libgdiplus-9999.ebuild
+++ b/dev-dotnet/libgdiplus/libgdiplus-9999.ebuild
@@ -33,7 +33,7 @@ DEPEND="${RDEPEND}"
 
 RESTRICT="test"
 
-PATCHES=( "${FILESDIR}/${PN}-2.10.9-giflib-quantizebuffer.patch"  )
+PATCHES=( "${FILESDIR}/${P}-giflib-quantizebuffer.patch"  )
 
 src_prepare() {
 	base_src_prepare


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/dotnet:master commit in: dev-dotnet/libgdiplus/, dev-dotnet/libgdiplus/files/
@ 2015-03-18 11:00 Heather Cynede
  0 siblings, 0 replies; 6+ messages in thread
From: Heather Cynede @ 2015-03-18 11:00 UTC (permalink / raw
  To: gentoo-commits

commit:     32258ce6032fb977e29021071c7e251976a3c783
Author:     Heather <Heather <AT> live <DOT> ru>
AuthorDate: Wed Mar 18 08:27:38 2015 +0000
Commit:     Heather Cynede <cynede <AT> gentoo <DOT> org>
CommitDate: Wed Mar 18 08:27:38 2015 +0000
URL:        https://gitweb.gentoo.org/proj/dotnet.git/commit/?id=32258ce6

libgdiplus bump to 3.12

 ...=> libgdiplus-3.12-giflib-quantizebuffer.patch} |  0
 dev-dotnet/libgdiplus/libgdiplus-3.12.ebuild       | 67 ++++++++++++++++++++++
 2 files changed, 67 insertions(+)

diff --git a/dev-dotnet/libgdiplus/files/libgdiplus-9999-giflib-quantizebuffer.patch b/dev-dotnet/libgdiplus/files/libgdiplus-3.12-giflib-quantizebuffer.patch
similarity index 100%
rename from dev-dotnet/libgdiplus/files/libgdiplus-9999-giflib-quantizebuffer.patch
rename to dev-dotnet/libgdiplus/files/libgdiplus-3.12-giflib-quantizebuffer.patch

diff --git a/dev-dotnet/libgdiplus/libgdiplus-3.12.ebuild b/dev-dotnet/libgdiplus/libgdiplus-3.12.ebuild
new file mode 100644
index 0000000..d1edf60
--- /dev/null
+++ b/dev-dotnet/libgdiplus/libgdiplus-3.12.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="5"
+inherit base eutils dotnet flag-o-matic
+
+DESCRIPTION="Library for using System.Drawing with mono"
+HOMEPAGE="http://www.mono-project.com"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86 ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
+SRC_URI="http://download.mono-project.com/sources/${PN}/${P}.tar.gz"
+
+IUSE="cairo"
+
+RDEPEND=">=dev-libs/glib-2.2.3:2
+	>=media-libs/freetype-2.3.7
+	>=media-libs/fontconfig-2.6
+	>=media-libs/libpng-1.4:0
+	x11-libs/libXrender
+	x11-libs/libX11
+	x11-libs/libXt
+	>=x11-libs/cairo-1.8.4[X]
+	media-libs/libexif
+	>=media-libs/giflib-4.2.3
+	virtual/jpeg:0
+	media-libs/tiff:0
+	!cairo? ( >=x11-libs/pango-1.20 )"
+DEPEND="${RDEPEND}"
+
+PATCHES=( "${FILESDIR}/${P}-giflib-quantizebuffer.patch"  )
+
+RESTRICT="test"
+
+src_prepare() {
+	base_src_prepare
+	sed -i -e 's:ungif:gif:g' configure || die
+}
+
+src_configure() {
+	append-flags -fno-strict-aliasing
+	econf 	--disable-dependency-tracking		\
+		--disable-static			\
+		--with-cairo=system			\
+		$(use !cairo && printf %s --with-pango)
+}
+
+src_compile() {
+	emake "$@"
+}
+
+src_install () {
+	emake -j1 DESTDIR="${D}" "$@" install #nowarn
+	dotnet_multilib_comply
+	local commondoc=( AUTHORS ChangeLog README TODO )
+	for docfile in "${commondoc[@]}"
+	do
+		[[ -e "${docfile}" ]] && dodoc "${docfile}"
+	done
+	if [[ "${DOCS[@]}" ]]
+	then
+		dodoc "${DOCS[@]}"
+	fi
+	prune_libtool_files
+}


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/dotnet:master commit in: dev-dotnet/libgdiplus/, dev-dotnet/libgdiplus/files/
@ 2015-08-18  9:50 Heather Cynede
  0 siblings, 0 replies; 6+ messages in thread
From: Heather Cynede @ 2015-08-18  9:50 UTC (permalink / raw
  To: gentoo-commits

commit:     0351cbb99dd780b6191ddaef945d0a29b9f99a02
Author:     Heather <Heather <AT> live <DOT> ru>
AuthorDate: Tue Aug 18 09:48:13 2015 +0000
Commit:     Heather Cynede <cynede <AT> gentoo <DOT> org>
CommitDate: Tue Aug 18 09:48:13 2015 +0000
URL:        https://gitweb.gentoo.org/proj/dotnet.git/commit/?id=0351cbb9

sync libgdiplus

 .../files/libgdiplus-2.10.9-freetype251.patch      | 12 +++++++
 .../files/libgdiplus-3.12-underlinking.patch       | 17 ++++++++++
 dev-dotnet/libgdiplus/libgdiplus-3.12.ebuild       | 39 +++++++++++-----------
 3 files changed, 48 insertions(+), 20 deletions(-)

diff --git a/dev-dotnet/libgdiplus/files/libgdiplus-2.10.9-freetype251.patch b/dev-dotnet/libgdiplus/files/libgdiplus-2.10.9-freetype251.patch
new file mode 100644
index 0000000..b4faa06
--- /dev/null
+++ b/dev-dotnet/libgdiplus/files/libgdiplus-2.10.9-freetype251.patch
@@ -0,0 +1,12 @@
+--- libgdiplus-2.10.9/src/gdiplus-private.h
++++ libgdiplus-2.10.9/src/gdiplus-private.h
+@@ -30,7 +30,8 @@
+ #include <stdio.h>
+ #include <math.h>
+ #include <glib.h>
+-#include <freetype/tttables.h>
++#include <ft2build.h>
++#include FT_TRUETYPE_TABLES_H
+ #include <pthread.h>
+ #include <unistd.h>
+ 

diff --git a/dev-dotnet/libgdiplus/files/libgdiplus-3.12-underlinking.patch b/dev-dotnet/libgdiplus/files/libgdiplus-3.12-underlinking.patch
new file mode 100644
index 0000000..164f994
--- /dev/null
+++ b/dev-dotnet/libgdiplus/files/libgdiplus-3.12-underlinking.patch
@@ -0,0 +1,17 @@
+ tests/Makefile.am | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index fb7aa7e..4d752e1 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -13,7 +13,8 @@ DEPS =						\
+ 
+ 
+ LDADDS =					\
+-	$(top_builddir)/src/libgdiplus.la
++	$(top_builddir)/src/libgdiplus.la \
++	-lm
+ 
+ noinst_PROGRAMS =			\
+ 	testgdi testbits testclip testreversepath

diff --git a/dev-dotnet/libgdiplus/libgdiplus-3.12.ebuild b/dev-dotnet/libgdiplus/libgdiplus-3.12.ebuild
index 5959db3..96eb910 100644
--- a/dev-dotnet/libgdiplus/libgdiplus-3.12.ebuild
+++ b/dev-dotnet/libgdiplus/libgdiplus-3.12.ebuild
@@ -3,7 +3,8 @@
 # $Id$
 
 EAPI=5
-inherit base eutils dotnet flag-o-matic
+
+inherit autotools eutils dotnet flag-o-matic
 
 DESCRIPTION="Library for using System.Drawing with mono"
 HOMEPAGE="http://www.mono-project.com"
@@ -30,38 +31,36 @@ RDEPEND=">=dev-libs/glib-2.2.3:2
 	!cairo? ( >=x11-libs/pango-1.20 )"
 DEPEND="${RDEPEND}"
 
-PATCHES=( "${FILESDIR}/${P}-giflib-quantizebuffer.patch"  )
+PATCHES=(
+	"${FILESDIR}/${P}-giflib-quantizebuffer.patch"
+	"${FILESDIR}/${P}-underlinking.patch"
+	)
 
 RESTRICT="test"
 
 src_prepare() {
-	base_src_prepare
-	sed -i -e 's:ungif:gif:g' configure || die
-}
-
-src_configure() {
+	epatch "${PATCHES[@]}"
+	sed -i -e 's:ungif:gif:g' configure.ac || die
 	append-flags -fno-strict-aliasing
-	econf 	--disable-dependency-tracking		\
-		--disable-static			\
-		--with-cairo=system			\
-		$(use !cairo && printf %s --with-pango)
+	eautoreconf
 }
 
-src_compile() {
-	emake "$@"
+src_configure() {
+	econf \
+		--disable-dependency-tracking \
+		--disable-static \
+		$(usex cairo "" "--with-pango")
 }
 
 src_install () {
-	emake -j1 DESTDIR="${D}" "$@" install #nowarn
+	MAKEOPTS+=" -j1"
+	default
+
 	dotnet_multilib_comply
 	local commondoc=( AUTHORS ChangeLog README TODO )
-	for docfile in "${commondoc[@]}"
-	do
+	for docfile in "${commondoc[@]}"; do
 		[[ -e "${docfile}" ]] && dodoc "${docfile}"
 	done
-	if [[ "${DOCS[@]}" ]]
-	then
-		dodoc "${DOCS[@]}"
-	fi
+	[[ "${DOCS[@]}" ]] && dodoc "${DOCS[@]}"
 	prune_libtool_files
 }


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/dotnet:master commit in: dev-dotnet/libgdiplus/, dev-dotnet/libgdiplus/files/
@ 2016-02-24 13:02 Heather Cynede
  0 siblings, 0 replies; 6+ messages in thread
From: Heather Cynede @ 2016-02-24 13:02 UTC (permalink / raw
  To: gentoo-commits

commit:     49cbc602a8d1187c42f7d0535309e12ea97e076e
Author:     ArsenShnurkov <Arsen.Shnurkov <AT> gmail <DOT> com>
AuthorDate: Fri Feb 19 11:32:15 2016 +0000
Commit:     Heather Cynede <cynede <AT> gentoo <DOT> org>
CommitDate: Fri Feb 19 11:32:15 2016 +0000
URL:        https://gitweb.gentoo.org/proj/dotnet.git/commit/?id=49cbc602

dependency version set to giflib-5.1.2

 .../libgdiplus-4.2-giflib-quantizebuffer.patch     | 297 ---------------------
 dev-dotnet/libgdiplus/libgdiplus-4.2-r2.ebuild     |  14 +-
 2 files changed, 1 insertion(+), 310 deletions(-)

diff --git a/dev-dotnet/libgdiplus/files/libgdiplus-4.2-giflib-quantizebuffer.patch b/dev-dotnet/libgdiplus/files/libgdiplus-4.2-giflib-quantizebuffer.patch
deleted file mode 100644
index 6f816d4..0000000
--- a/dev-dotnet/libgdiplus/files/libgdiplus-4.2-giflib-quantizebuffer.patch
+++ /dev/null
@@ -1,297 +0,0 @@
-diff --git a/src/gifcodec.c b/src/gifcodec.c
-index 6f8dedb..0868713 100644
---- a/src/gifcodec.c
-+++ b/src/gifcodec.c
-@@ -39,6 +39,292 @@ GUID gdip_gif_image_format_guid = {0xb96b3cb0U, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0
- 
- #include "gifcodec.h"
- 
-+#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;
-+
-+
-+/****************************************************************************
-+ * 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];
-+}
-+
-+/******************************************************************************
-+ * 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 (MaxSize == -1)
-+            return GIF_OK;
-+
-+        /* Split the entry Index into two along the axis SortRGBAxis: */
-+
-+        /* 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;
-+
-+        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;
-+        }
-+        /* 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)++;
-+    }
-+
-+    return GIF_OK;
-+}
-+
-+/******************************************************************************
-+ * 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;
-+        }
-+    }
-+
-+    /* 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,
-+                    "\n%s: Null entry in quantized color map - that's weird.\n",
-+                    "libgdiplus");
-+    }
-+
-+    /* 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]);
-+    }
-+
-+#ifdef DEBUG
-+    fprintf(stderr,
-+            "Quantization L(0) errors: Red = %d, Green = %d, Blue = %d.\n",
-+            MaxRGBError[0], MaxRGBError[1], MaxRGBError[2]);
-+#endif /* DEBUG */
-+
-+    free((char *)ColorArrayEntries);
-+
-+    *ColorMapSize = NewColorMapSize;
-+
-+    return GIF_OK;
-+}
- 
- /* Data structure used for callback */
- typedef struct

diff --git a/dev-dotnet/libgdiplus/libgdiplus-4.2-r2.ebuild b/dev-dotnet/libgdiplus/libgdiplus-4.2-r2.ebuild
index 56b287e..bb2df21 100644
--- a/dev-dotnet/libgdiplus/libgdiplus-4.2-r2.ebuild
+++ b/dev-dotnet/libgdiplus/libgdiplus-4.2-r2.ebuild
@@ -25,24 +25,12 @@ RDEPEND=">=dev-libs/glib-2.2.3:2
 	x11-libs/libXt
 	>=x11-libs/cairo-1.8.4[X]
 	media-libs/libexif
-	>=media-libs/giflib-4.2.3
+	>=media-libs/giflib-5.1.2
 	virtual/jpeg:0
 	media-libs/tiff:0
 	!cairo? ( >=x11-libs/pango-1.20 )"
 DEPEND="${RDEPEND}"
 
-src_prepare() {
-	# ${PV} = Package version (excluding revision, if any), for example 6.3
-	eapply "${FILESDIR}/libgdiplus-${PV}-giflib-quantizebuffer.patch"
-	sed -i -e 's:ungif:gif:g' configure.ac || die
-	#append-flags -fno-strict-aliasing
-	# append-flags: command not found
-	#eautoreconf
-	# eautoreconf: command not found
-
-	eapply_user
-}
-
 src_configure() {
 	econf \
 		--disable-dependency-tracking \


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/dotnet:master commit in: dev-dotnet/libgdiplus/, dev-dotnet/libgdiplus/files/
@ 2016-02-24 13:02 Heather Cynede
  0 siblings, 0 replies; 6+ messages in thread
From: Heather Cynede @ 2016-02-24 13:02 UTC (permalink / raw
  To: gentoo-commits

commit:     8f975abd595dddd8a26601598fe29cff6c8a5f48
Author:     ArsenShnurkov <Arsen.Shnurkov <AT> gmail <DOT> com>
AuthorDate: Fri Feb 19 10:11:47 2016 +0000
Commit:     Heather Cynede <cynede <AT> gentoo <DOT> org>
CommitDate: Fri Feb 19 10:11:47 2016 +0000
URL:        https://gitweb.gentoo.org/proj/dotnet.git/commit/?id=8f975abd

patch restored

 .../libgdiplus-4.2-giflib-quantizebuffer.patch     | 297 +++++++++++++++++++++
 dev-dotnet/libgdiplus/libgdiplus-4.2-r2.ebuild     |  14 +-
 2 files changed, 310 insertions(+), 1 deletion(-)

diff --git a/dev-dotnet/libgdiplus/files/libgdiplus-4.2-giflib-quantizebuffer.patch b/dev-dotnet/libgdiplus/files/libgdiplus-4.2-giflib-quantizebuffer.patch
new file mode 100644
index 0000000..6f816d4
--- /dev/null
+++ b/dev-dotnet/libgdiplus/files/libgdiplus-4.2-giflib-quantizebuffer.patch
@@ -0,0 +1,297 @@
+diff --git a/src/gifcodec.c b/src/gifcodec.c
+index 6f8dedb..0868713 100644
+--- a/src/gifcodec.c
++++ b/src/gifcodec.c
+@@ -39,6 +39,292 @@ GUID gdip_gif_image_format_guid = {0xb96b3cb0U, 0x0728U, 0x11d3U, {0x9d, 0x7b, 0
+ 
+ #include "gifcodec.h"
+ 
++#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;
++
++
++/****************************************************************************
++ * 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];
++}
++
++/******************************************************************************
++ * 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 (MaxSize == -1)
++            return GIF_OK;
++
++        /* Split the entry Index into two along the axis SortRGBAxis: */
++
++        /* 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;
++
++        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;
++        }
++        /* 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)++;
++    }
++
++    return GIF_OK;
++}
++
++/******************************************************************************
++ * 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;
++        }
++    }
++
++    /* 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,
++                    "\n%s: Null entry in quantized color map - that's weird.\n",
++                    "libgdiplus");
++    }
++
++    /* 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]);
++    }
++
++#ifdef DEBUG
++    fprintf(stderr,
++            "Quantization L(0) errors: Red = %d, Green = %d, Blue = %d.\n",
++            MaxRGBError[0], MaxRGBError[1], MaxRGBError[2]);
++#endif /* DEBUG */
++
++    free((char *)ColorArrayEntries);
++
++    *ColorMapSize = NewColorMapSize;
++
++    return GIF_OK;
++}
+ 
+ /* Data structure used for callback */
+ typedef struct

diff --git a/dev-dotnet/libgdiplus/libgdiplus-4.2-r2.ebuild b/dev-dotnet/libgdiplus/libgdiplus-4.2-r2.ebuild
index 2265860..56b287e 100644
--- a/dev-dotnet/libgdiplus/libgdiplus-4.2-r2.ebuild
+++ b/dev-dotnet/libgdiplus/libgdiplus-4.2-r2.ebuild
@@ -2,7 +2,7 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
-EAPI=5
+EAPI=6
 
 inherit eutils dotnet
 
@@ -31,6 +31,18 @@ RDEPEND=">=dev-libs/glib-2.2.3:2
 	!cairo? ( >=x11-libs/pango-1.20 )"
 DEPEND="${RDEPEND}"
 
+src_prepare() {
+	# ${PV} = Package version (excluding revision, if any), for example 6.3
+	eapply "${FILESDIR}/libgdiplus-${PV}-giflib-quantizebuffer.patch"
+	sed -i -e 's:ungif:gif:g' configure.ac || die
+	#append-flags -fno-strict-aliasing
+	# append-flags: command not found
+	#eautoreconf
+	# eautoreconf: command not found
+
+	eapply_user
+}
+
 src_configure() {
 	econf \
 		--disable-dependency-tracking \


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-02-24 13:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-11  4:18 [gentoo-commits] proj/dotnet:master commit in: dev-dotnet/libgdiplus/, dev-dotnet/libgdiplus/files/ Heather Cynede
  -- strict thread matches above, loose matches on Subject: below --
2014-12-27 16:52 Heather Cynede
2015-03-18 11:00 Heather Cynede
2015-08-18  9:50 Heather Cynede
2016-02-24 13:02 Heather Cynede
2016-02-24 13:02 Heather Cynede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox