MCPcopy Create free account
hub / github.com/DentonW/DevIL / ILAPIENTRY ilRegisterMipNum

Function ILAPIENTRY ilRegisterMipNum

DevIL/src-IL/src/il_register.cpp:305–339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303
304
305ILboolean ILAPIENTRY ilRegisterMipNum(ILuint Num)
306{
307 ILimage *Next, *Prev;
308
309 ilBindImage(ilGetCurName()); // Make sure the current image is actually bound.
310 ilCloseImage(iCurImage->Mipmaps); // Close any current mipmaps.
311
312 iCurImage->Mipmaps = NULL;
313 if (Num == 0) // Just gets rid of all the mipmaps.
314 return IL_TRUE;
315
316 iCurImage->Mipmaps = ilNewImage(1, 1, 1, 1, 1);
317 if (iCurImage->Mipmaps == NULL)
318 return IL_FALSE;
319 Next = iCurImage->Mipmaps;
320 Num--;
321
322 while (Num) {
323 Next->Next = ilNewImage(1, 1, 1, 1, 1);
324 if (Next->Next == NULL) {
325 // Clean up before we error out.
326 Prev = iCurImage->Mipmaps;
327 while (Prev) {
328 Next = Prev->Next;
329 ilCloseImage(Prev);
330 Prev = Next;
331 }
332 return IL_FALSE;
333 }
334 Next = Next->Next;
335 Num--;
336 }
337
338 return IL_TRUE;
339}
340
341
342ILboolean ILAPIENTRY ilRegisterNumImages(ILuint Num)

Callers

nothing calls this directly

Calls 2

ilGetCurNameFunction · 0.85
ilCloseImageFunction · 0.85

Tested by

no test coverage detected