gifsicle: fix gcc2 build.

This commit is contained in:
Jerome Duval
2019-05-03 19:06:05 +02:00
parent 3f9ebedbe9
commit 076894e282
2 changed files with 49 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="http://www.lcdf.org/gifsicle/gifsicle-$portVersion.tar.gz"
CHECKSUM_SHA256="5ab556c01d65fddf980749e3ccf50b7fd40de738b6df679999294cc5fabfce65"
PATCHES="gifsicle-$portVersion.patchset"
ARCHITECTURES="x86_gcc2 x86 x86_64"

View File

@@ -0,0 +1,48 @@
From b1338f362620d9bbfe4c1ca41ae37c0c7ceeca53 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 3 May 2019 19:04:54 +0200
Subject: gcc2 patch
diff --git a/src/gifwrite.c b/src/gifwrite.c
index 3688a09..50b2c4d 100644
--- a/src/gifwrite.c
+++ b/src/gifwrite.c
@@ -210,6 +210,8 @@ typedef struct gfc_rgbdiff {signed short r, g, b;} gfc_rgbdiff;
/* Difference (MSE) between given color indexes + dithering error */
static inline unsigned int color_diff(Gif_Color a, Gif_Color b, int a_transparent, int b_transparent, gfc_rgbdiff dither)
{
+ unsigned int dith, undith;
+
/* if one is transparent and the other is not, then return maximum difference */
/* TODO: figure out what color is in the canvas under the transparent pixel and match against that */
if (a_transparent != b_transparent) return 1<<25;
@@ -218,11 +220,11 @@ static inline unsigned int color_diff(Gif_Color a, Gif_Color b, int a_transparen
if (a_transparent) return 0;
/* squared error with or without dithering. */
- unsigned int dith = (a.gfc_red-b.gfc_red+dither.r)*(a.gfc_red-b.gfc_red+dither.r)
+ dith = (a.gfc_red-b.gfc_red+dither.r)*(a.gfc_red-b.gfc_red+dither.r)
+ (a.gfc_green-b.gfc_green+dither.g)*(a.gfc_green-b.gfc_green+dither.g)
+ (a.gfc_blue-b.gfc_blue+dither.b)*(a.gfc_blue-b.gfc_blue+dither.b);
- unsigned int undith = (a.gfc_red-b.gfc_red+dither.r/2)*(a.gfc_red-b.gfc_red+dither.r/2)
+ undith = (a.gfc_red-b.gfc_red+dither.r/2)*(a.gfc_red-b.gfc_red+dither.r/2)
+ (a.gfc_green-b.gfc_green+dither.g/2)*(a.gfc_green-b.gfc_green+dither.g/2)
+ (a.gfc_blue-b.gfc_blue+dither.b/2)*(a.gfc_blue-b.gfc_blue+dither.b/2);
@@ -336,9 +338,10 @@ gfc_lookup_lossy(Gif_CodeTable *gfc, const Gif_Colormap *gfcm, Gif_Image *gfi,
unsigned image_endpos = gfi->width * gfi->height;
struct selected_node best_t = {node, pos, base_diff};
+ uint8_t suffix;
if (pos >= image_endpos) return best_t;
- uint8_t suffix = gif_pixel_at_pos(gfi, pos);
+ suffix = gif_pixel_at_pos(gfi, pos);
assert(!node || (node >= gfc->nodes && node < gfc->nodes + NODES_SIZE));
assert(suffix < gfc->clear_code);
if (!node) {
--
2.21.0