graphics/exact-image: Updated for version 0.9.1.

Patched to fix build failure with giflib-5.1 & libpng16 (-current).

Signed-off-by: David Spencer <baildon.research@googlemail.com>
This commit is contained in:
David Spencer 2015-08-04 15:26:47 +01:00 committed by Willy Sudiarto Raharjo
parent 6052a66182
commit b6cdff1cab
4 changed files with 205 additions and 16 deletions

View File

@ -0,0 +1,139 @@
--- exact-image-0.8.9/codecs/gif.cc.orig 2010-03-03 22:04:44.000000000 +0100
+++ exact-image-0.8.9/codecs/gif.cc 2014-10-20 16:45:48.021255431 +0200
@@ -17,6 +17,12 @@
#include <gif_lib.h>
+#if (GIFLIB_MAJOR > 5) || (GIFLIB_MINOR >= 1)
+#define Internal_EGifCloseFile(f) EGifCloseFile(f, NULL)
+#else
+#define Internal_EGifCloseFile(f) EGifCloseFile(f)
+#endif
+
#include "gif.hh"
#include "Colorspace.hh"
@@ -58,11 +64,11 @@
GifRecordType RecordType;
GifByteType* Extension;
ColorMapObject *ColorMap = NULL;
- int ExtCode;
+ int ExtCode, GifError;
- if ((GifFile = DGifOpen (stream, &GIFInputFunc)) == NULL)
+ if ((GifFile = DGifOpen (stream, &GIFInputFunc, &GifError)) == NULL)
{
- PrintGifError();
+ std::cerr << "Error: " << GifErrorString(GifError) << std::endl;
return false;
}
@@ -74,7 +80,7 @@
/* Scan the content of the GIF file and load the image(s) in: */
do {
if (DGifGetRecordType(GifFile, &RecordType) == GIF_ERROR) {
- PrintGifError();
+ std::cerr << "DGifGetRecordType error: " << GifErrorString(GifFile->Error) << std::endl;
return false;
}
@@ -83,7 +89,7 @@
switch (RecordType) {
case IMAGE_DESC_RECORD_TYPE:
if (DGifGetImageDesc(GifFile) == GIF_ERROR) {
- PrintGifError();
+ std::cerr << "DGifGetImageDesc error: " << GifErrorString(GifFile->Error) << std::endl;
return false;
}
@@ -104,7 +110,7 @@
j += InterlacedJumps[i]) {
if (DGifGetLine(GifFile, &image.getRawData()[j*image.stride()+Col],
Width) == GIF_ERROR) {
- PrintGifError();
+ std::cerr << "DGifGetLine error: " << GifErrorString(GifFile->Error) << std::endl;
return false;
}
}
@@ -113,7 +119,7 @@
for (int i = 0; i < Height; ++i) {
if (DGifGetLine(GifFile, &image.getRawData()[Row++ * image.stride()+Col],
Width) == GIF_ERROR) {
- PrintGifError();
+ std::cerr << "DGifGetLine error: " << GifErrorString(GifFile->Error) << std::endl;
return false;
}
}
@@ -122,12 +128,12 @@
case EXTENSION_RECORD_TYPE:
/* Skip any extension blocks in file: */
if (DGifGetExtension(GifFile, &ExtCode, &Extension) == GIF_ERROR) {
- PrintGifError();
+ std::cerr << "DGifGetExtension error: " << GifErrorString(GifFile->Error) << std::endl;
return false;
}
while (Extension != NULL) {
if (DGifGetExtensionNext(GifFile, &Extension) == GIF_ERROR) {
- PrintGifError();
+ std::cerr << "DGifGetExtensionNext error: " << GifErrorString(GifFile->Error) << std::endl;
return false;
}
}
@@ -155,7 +161,7 @@
// convert colormap to our 16bit "TIFF"format
colorspace_de_palette (image, ColorMap->ColorCount, rmap, gmap, bmap);
- EGifCloseFile(GifFile);
+ Internal_EGifCloseFile(GifFile);
return true;
}
@@ -165,17 +171,18 @@
{
GifFileType* GifFile;
GifByteType* Ptr;
+ int GifError;
- if ((GifFile = EGifOpen (stream, &GIFOutputFunc)) == NULL)
+ if ((GifFile = EGifOpen (stream, &GIFOutputFunc, &GifError)) == NULL)
{
- std::cerr << "Error preparing GIF file for writing." << std::endl;
+ std::cerr << "Error preparing GIF file for writing: " << GifErrorString(GifError) << std::endl;
return false;
}
int ColorMapSize = 256;
// later use our own colormap generation
- ColorMapObject* OutputColorMap = MakeMapObject(ColorMapSize, NULL);
+ ColorMapObject* OutputColorMap = GifMakeMapObject(ColorMapSize, NULL);
if (!OutputColorMap)
return false;
@@ -203,7 +210,7 @@
}
- if (QuantizeBuffer(image.w, image.h, &ColorMapSize,
+ if (GifQuantizeBuffer(image.w, image.h, &ColorMapSize,
RedBuffer, GreenBuffer, BlueBuffer,
OutputBuffer, OutputColorMap->Colors) == GIF_ERROR) {
return false;
@@ -215,7 +222,7 @@
if (EGifPutScreenDesc(GifFile, image.w, image.h,
ColorMapSize, 0, OutputColorMap) == GIF_ERROR ||
EGifPutImageDesc(GifFile, 0, 0, image.w, image.h,
- FALSE, NULL) == GIF_ERROR)
+ false, NULL) == GIF_ERROR)
{
std::cerr << "Error writing GIF header." << std::endl;
return false;
@@ -234,7 +241,7 @@
delete (RedBuffer); delete (GreenBuffer); delete (BlueBuffer);
- EGifCloseFile(GifFile);
+ Internal_EGifCloseFile(GifFile);
return true;
}

View File

@ -1,7 +1,28 @@
diff -Naur exact-image-0.8.7-old/codecs/png.cc exact-image-0.8.7/codecs/png.cc
--- exact-image-0.8.7-old/codecs/png.cc
+++ exact-image-0.8.7/codecs/png.cc
@@ -71,7 +71,7 @@
Description: Fix FTBFS with libpng 1.5
Author: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Approved: Ralf Treinen <treinen@debian.org>
Bug-Debian: #635745
--- exactimage-0.8.5.orig/codecs/png.cc
+++ exactimage-0.8.5/codecs/png.cc
@@ -17,6 +17,7 @@
#include <stdlib.h>
#include <png.h>
+#include <zlib.h>
#include <iostream>
@@ -58,7 +59,7 @@ int PNGCodec::readImage (std::istream* s
png_structp png_ptr;
png_infop info_ptr;
png_uint_32 width, height;
- int bit_depth, color_type, interlace_type;
+ int bit_depth, color_type, interlace_type, num_trans;
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
NULL /*user_error_ptr*/,
@@ -71,7 +72,7 @@ int PNGCodec::readImage (std::istream* s
/* Allocate/initialize the memory for image information. REQUIRED. */
info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == NULL) {
@ -10,7 +31,7 @@ diff -Naur exact-image-0.8.7-old/codecs/png.cc exact-image-0.8.7/codecs/png.cc
return 0;
}
@@ -82,7 +82,7 @@
@@ -82,7 +83,7 @@ int PNGCodec::readImage (std::istream* s
if (setjmp(png_jmpbuf(png_ptr))) {
/* Free all of the memory associated with the png_ptr and info_ptr */
@ -19,7 +40,7 @@ diff -Naur exact-image-0.8.7-old/codecs/png.cc exact-image-0.8.7/codecs/png.cc
/* If we get here, we had a problem reading the file */
return 0;
}
@@ -99,7 +99,7 @@
@@ -99,13 +100,13 @@ int PNGCodec::readImage (std::istream* s
png_read_info (png_ptr, info_ptr);
png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
@ -28,7 +49,30 @@ diff -Naur exact-image-0.8.7-old/codecs/png.cc exact-image-0.8.7/codecs/png.cc
image.w = width;
image.h = height;
@@ -196,11 +196,11 @@
image.bps = bit_depth;
- image.spp = info_ptr->channels;
-
+ image.spp = png_get_channels(png_ptr, info_ptr);
+
png_uint_32 res_x, res_y;
res_x = png_get_x_pixels_per_meter(png_ptr, info_ptr);
res_y = png_get_y_pixels_per_meter(png_ptr, info_ptr);
@@ -119,11 +120,13 @@ int PNGCodec::readImage (std::istream* s
* (not useful if you are using png_set_packing). */
// png_set_packswap(png_ptr);
+ png_get_tRNS(png_ptr, info_ptr, NULL, &num_trans, NULL);
+
/* Expand paletted colors into true RGB triplets */
if (color_type == PNG_COLOR_TYPE_PALETTE) {
png_set_palette_to_rgb(png_ptr);
image.bps = 8;
- if (info_ptr->num_trans)
+ if (num_trans)
image.spp = 4;
else
image.spp = 3;
@@ -196,11 +199,11 @@ int PNGCodec::readImage (std::istream* s
for (int pass = 0; pass < number_passes; ++pass)
for (unsigned int y = 0; y < height; ++y) {
row_pointers[0] = image.getRawData() + y * stride;
@ -42,7 +86,7 @@ diff -Naur exact-image-0.8.7-old/codecs/png.cc exact-image-0.8.7/codecs/png.cc
/* that's it */
return true;
@@ -224,7 +224,7 @@
@@ -224,7 +227,7 @@ bool PNGCodec::writeImage (std::ostream*
/* Allocate/initialize the memory for image information. REQUIRED. */
info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == NULL) {
@ -51,12 +95,15 @@ diff -Naur exact-image-0.8.7-old/codecs/png.cc exact-image-0.8.7/codecs/png.cc
return false;
}
@@ -244,8 +244,6 @@
@@ -244,8 +247,10 @@ bool PNGCodec::writeImage (std::ostream*
else if (quality > Z_BEST_COMPRESSION) quality = Z_BEST_COMPRESSION;
png_set_compression_level(png_ptr, quality);
- png_info_init (info_ptr);
+ /* Need?
png_info_init (info_ptr);
-
+ */
+
/* Set up our STL stream output control */
png_set_write_fn (png_ptr, stream, &stdstream_write_data, &stdstream_flush_data);

View File

@ -3,7 +3,7 @@
# Written by Benjamin Trigona-Harany <slackbuilds@jaxartes.net>
PRGNAM=exact-image
VERSION=${VERSION:-0.8.9}
VERSION=${VERSION:-0.9.1}
BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
@ -49,8 +49,11 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
# Patch to fix libpng linkage
patch -p1 --verbose < $CWD/png.cc-libpng14.diff
# Patch to fix build with libpng16 (-current) (thanks to Debian)
patch -p1 --verbose < $CWD/exact-image-libpng15.patch
# Patch to fix build with giflib-5.1 (-current) (thanks to PLD Linux)
patch -p1 --verbose < $CWD/exact-image-giflib.patch
# Patch to fix perl path
eval $(perl -V:vendorlib)

View File

@ -1,8 +1,8 @@
PRGNAM="exact-image"
VERSION="0.8.9"
VERSION="0.9.1"
HOMEPAGE="http://www.exactcode.de/site/open_source/exactimage/"
DOWNLOAD="http://dl.exactcode.de/oss/exact-image/exact-image-0.8.9.tar.bz2"
MD5SUM="a8694722cd7cc9aa9407950a8440f0cd"
DOWNLOAD="http://dl.exactcode.de/oss/exact-image/exact-image-0.9.1.tar.bz2"
MD5SUM="864eddf488c309a02262f4e07b0fe319"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="agg"