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 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 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;iColorCount, 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;