summaryrefslogtreecommitdiff
path: root/media-video/qgifer/files/qgifer-0.2.1-giflib5.patch
blob: 9ddfdac80641dad5a5c871a99e9ebab3ed5c7e17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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;