MCPcopy Create free account
hub / github.com/DentonW/DevIL / GetImages

Function GetImages

DevIL/src-IL/src/il_gif.cpp:231–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229
230
231ILboolean GetImages(ILpal *GlobalPal, GIFHEAD *GifHead)
232{
233 IMAGEDESC ImageDesc, OldImageDesc;
234 GFXCONTROL Gfx;
235 ILboolean BaseImage = IL_TRUE;
236 ILimage *Image = iCurImage, *TempImage = NULL, *PrevImage = NULL;
237 ILuint NumImages = 0, i;
238 ILint input;
239 ILuint PalOffset;
240
241 OldImageDesc.ImageInfo = 0; // to initialize the data with an harmless value
242 Gfx.Used = IL_TRUE;
243
244 while (!ieof()) {
245 ILubyte DisposalMethod = 1;
246
247 i = itell();
248 if (!SkipExtensions(&Gfx))
249 goto error_clean;
250 i = itell();
251
252 if (!Gfx.Used)
253 DisposalMethod = (Gfx.Packed & 0x1C) >> 2;
254
255 //read image descriptor
256 ImageDesc.Separator = igetc();
257 if (ImageDesc.Separator != 0x2C) //end of image
258 break;
259 ImageDesc.OffX = GetLittleUShort();
260 ImageDesc.OffY = GetLittleUShort();
261 ImageDesc.Width = GetLittleUShort();
262 ImageDesc.Height = GetLittleUShort();
263 ImageDesc.ImageInfo = igetc();
264
265 if (ieof()) {
266 ilGetError(); // Gets rid of the IL_FILE_READ_ERROR that inevitably results.
267 break;
268 }
269
270
271 if (!BaseImage) {
272 NumImages++;
273 Image->Next = ilNewImage(iCurImage->Width, iCurImage->Height, 1, 1, 1);
274 if (Image->Next == NULL)
275 goto error_clean;
276 //20040612: DisposalMethod controls how the new images data is to be combined
277 //with the old image. 0 means that it doesn't matter how they are combined,
278 //1 means keep the old image, 2 means set to background color, 3 is
279 //load the image that was in place before the current (this is not implemented
280 //here! (TODO?))
281 if (DisposalMethod == 2 || DisposalMethod == 3)
282 //Note that this is actually wrong, too: If the image has a local
283 //color table, we should really search for the best fit of the
284 //background color table and use that index (?). Furthermore,
285 //we should only memset the part of the image that is not read
286 //later (if we are sure that no parts of the read image are transparent).
287 if (!Gfx.Used && Gfx.Packed & 0x1)
288 memset(Image->Next->Data, Gfx.Transparent, Image->SizeOfData);

Callers 1

iLoadGifInternalFunction · 0.85

Calls 8

SkipExtensionsFunction · 0.85
GetLittleUShortFunction · 0.85
RemoveInterlaceFunction · 0.85
iGetPaletteFunction · 0.85
iCopyPaletteFunction · 0.85
GifGetDataFunction · 0.85
ilSetErrorFunction · 0.85
ConvertTransparentFunction · 0.85

Tested by

no test coverage detected