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

Function ILAPIENTRY ilDeleteImages

DevIL/src-IL/src/il_stack.cpp:123–173  ·  view source on GitHub ↗

Deletes Num images from the image stack - similar to glDeleteTextures().

Source from the content-addressed store, hash-verified

121
122//! Deletes Num images from the image stack - similar to glDeleteTextures().
123void ILAPIENTRY ilDeleteImages(ILsizei Num, const ILuint *Images)
124{
125 iFree *Temp = FreeNames;
126 ILuint Index = 0;
127
128 if (Num < 1) {
129 //ilSetError(IL_INVALID_VALUE);
130 return;
131 }
132 if (StackSize == 0)
133 return;
134
135 do {
136 if (Images[Index] > 0 && Images[Index] < LastUsed) { // <= ?
137 /*if (FreeNames != NULL) { // Terribly inefficient
138 Temp = FreeNames;
139 do {
140 if (Temp->Name == Images[Index]) {
141 continue; // Sufficient?
142 }
143 } while ((Temp = Temp->Next));
144 }*/
145
146 // Already has been deleted or was never used.
147 if (ImageStack[Images[Index]] == NULL)
148 continue;
149
150 // Find out if current image - if so, set to default image zero.
151 if (Images[Index] == CurName || Images[Index] == 0) {
152 iCurImage = ImageStack[0];
153 CurName = 0;
154 }
155
156 // Should *NOT* be NULL here!
157 ilCloseImage(ImageStack[Images[Index]]);
158 ImageStack[Images[Index]] = NULL;
159
160 // Add to head of list - works for empty and non-empty lists
161 Temp = (iFree*)ialloc(sizeof(iFree));
162 if (!Temp) {
163 return;
164 }
165 Temp->Name = Images[Index];
166 Temp->Next = FreeNames;
167 FreeNames = Temp;
168 }
169 /*else { // Shouldn't set an error...just continue onward.
170 ilSetError(IL_ILLEGAL_OPERATION);
171 }*/
172 } while (++Index < (ILuint)Num);
173}
174
175
176void ILAPIENTRY ilDeleteImage(const ILuint Num) {

Callers

nothing calls this directly

Calls 1

ilCloseImageFunction · 0.85

Tested by

no test coverage detected