Various compilation scripts & patches for Linux programs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

157 lines
4.4 KiB

Port qgifer to giflib 5 API.
See also: https://bugs.gentoo.org/show_bug.cgi?id=536634
--- a/src/gifcreator.cpp
+++ b/src/gifcreator.cpp
@@ -38,7 +38,7 @@
j--;
}
for(int i=0;i<cmaps.size();i++)
- FreeMapObject(cmaps[i]);
+ GifFreeMapObject(cmaps[i]);
}
@@ -52,7 +52,7 @@
}
- GifFileType *GifFile = EGifOpenFileName(filename, FALSE);
+ GifFileType *GifFile = EGifOpenFileName(filename, 0, NULL);
if (!GifFile){
PrintGifError();
@@ -74,7 +74,7 @@
{
char nsle[12] = "NETSCAPE2.0";
char subblock[3];
- if (EGifPutExtensionFirst(GifFile, APPLICATION_EXT_FUNC_CODE, 11, nsle) == GIF_ERROR) {
+ if (EGifPutExtension(GifFile, APPLICATION_EXT_FUNC_CODE, 11, nsle) == GIF_ERROR) {
PrintGifError();
return false;
}
@@ -82,7 +82,7 @@
subblock[2] = loop_count % 256;
subblock[1] = loop_count / 256;
- if (EGifPutExtensionLast(GifFile, APPLICATION_EXT_FUNC_CODE, 3, subblock) == GIF_ERROR) {
+ if (EGifPutExtension(GifFile, APPLICATION_EXT_FUNC_CODE, 3, subblock) == GIF_ERROR) {
PrintGifError();
return false;
}
@@ -111,7 +111,7 @@
if (EGifPutImageDesc(
GifFile,
- 0, 0, w, h, FALSE, cmaps.size() > ni ? cmaps.at(ni) : cmaps.at(cmaps.size()-1)
+ 0, 0, w, h, 0, cmaps.size() > ni ? cmaps.at(ni) : cmaps.at(cmaps.size()-1)
) == GIF_ERROR) {
PrintGifError();
endProgress();
@@ -135,7 +135,7 @@
return false;
}
- if (EGifCloseFile(GifFile) == GIF_ERROR) {
+ if (EGifCloseFile(GifFile, NULL) == GIF_ERROR) {
PrintGifError();
endProgress();
return false;
--- a/src/gifcreator.h
+++ b/src/gifcreator.h
@@ -31,6 +31,12 @@
typedef vector<GifByteType> Frame;
typedef unsigned char Byte;
+static inline void
+PrintGifError()
+{
+ fprintf(stderr, "\nGIF-LIB error: %s.\n", GifErrorString(GIF_ERROR));
+}
+
class GifCreator
{
--- a/src/palettewidget.cpp
+++ b/src/palettewidget.cpp
@@ -34,7 +34,7 @@
PaletteWidget::~PaletteWidget()
{
- FreeMapObject(palette);
+ GifFreeMapObject(palette);
}
void PaletteWidget::paintEvent(QPaintEvent*)
@@ -117,7 +117,7 @@
if(palette && mindiff > 1)
{
qDebug() << "deleting old palette, size: " << size << ", colors: " << palette->ColorCount;
- FreeMapObject(palette);
+ GifFreeMapObject(palette);
qDebug() << "done";
palette = NULL;
}
@@ -157,7 +157,7 @@
}
ColorMapObject* previous = palette;
- palette = MakeMapObject(size, NULL);
+ palette = GifMakeMapObject(size, NULL);
if (!palette)
{
qDebug() << "NULL palette!";
@@ -165,7 +165,7 @@
}
- if (QuantizeBuffer(fimg.width(), fimg.height(), &size,
+ if (GifQuantizeBuffer(fimg.width(), fimg.height(), &size,
&(r[0]),&(g[0]),&(b[0]), &(output[0]),
palette->Colors) == GIF_ERROR)
{
@@ -178,11 +178,11 @@
//qDebug() << "difference: " << df;
if(previous && df < mindiff)
{
- FreeMapObject(palette);
+ GifFreeMapObject(palette);
palette = previous;
}
else if(df >= mindiff)
- FreeMapObject(previous);
+ GifFreeMapObject(previous);
// qDebug() << "palette (" << palette->ColorCount << ") :";
// for(int i=0;i<size;i++)
@@ -230,8 +230,8 @@
{
QStringList rgb = QString(str).split(";", QString::SkipEmptyParts);
if(palette)
- FreeMapObject(palette);
- palette = MakeMapObject(rgb.size(), NULL);
+ GifFreeMapObject(palette);
+ palette = GifMakeMapObject(rgb.size(), NULL);
if(!palette)
return false;
size = rgb.size();
--- a/src/palettewidget.h
+++ b/src/palettewidget.h
@@ -30,7 +30,7 @@
PaletteWidget(QWidget* parent=0, Qt::WindowFlags f=0);
virtual ~PaletteWidget();
ColorMapObject* map() {return palette;}
- ColorMapObject* mapCopy() {return MakeMapObject(palette->ColorCount, palette->Colors);}
+ ColorMapObject* mapCopy() {return GifMakeMapObject(palette->ColorCount, palette->Colors);}
bool fromImage(const QImage& img, int palette_size, float mindiff = 2);
void setColumnCount(int cc){cols = cc;}
bool toFile(const QString& path);
@@ -38,7 +38,7 @@
QString toString();
bool fromString(const QString& str);
int getSize() const {return size;}
- void clear() {if(palette) FreeMapObject(palette); palette = NULL; update();}
+ void clear() {if(palette) GifFreeMapObject(palette); palette = NULL; update();}
private:
int size;
int cols;