Closes Image and frees all memory associated with it.
| 201 | |
| 202 | //! Closes Image and frees all memory associated with it. |
| 203 | ILAPI void ILAPIENTRY ilCloseImage(ILimage *Image) |
| 204 | { |
| 205 | if (Image == NULL) |
| 206 | return; |
| 207 | |
| 208 | if (Image->Data != NULL) { |
| 209 | ifree(Image->Data); |
| 210 | Image->Data = NULL; |
| 211 | } |
| 212 | |
| 213 | if (Image->Pal.Palette != NULL && Image->Pal.PalSize > 0 && Image->Pal.PalType != IL_PAL_NONE) { |
| 214 | ifree(Image->Pal.Palette); |
| 215 | Image->Pal.Palette = NULL; |
| 216 | } |
| 217 | |
| 218 | if (Image->Next != NULL) { |
| 219 | ilCloseImage(Image->Next); |
| 220 | Image->Next = NULL; |
| 221 | } |
| 222 | |
| 223 | if (Image->Faces != NULL) { |
| 224 | ilCloseImage(Image->Faces); |
| 225 | Image->Mipmaps = NULL; |
| 226 | } |
| 227 | |
| 228 | if (Image->Mipmaps != NULL) { |
| 229 | ilCloseImage(Image->Mipmaps); |
| 230 | Image->Mipmaps = NULL; |
| 231 | } |
| 232 | |
| 233 | if (Image->Layers != NULL) { |
| 234 | ilCloseImage(Image->Layers); |
| 235 | Image->Layers = NULL; |
| 236 | } |
| 237 | |
| 238 | if (Image->AnimList != NULL && Image->AnimSize != 0) { |
| 239 | ifree(Image->AnimList); |
| 240 | Image->AnimList = NULL; |
| 241 | } |
| 242 | |
| 243 | if (Image->Profile != NULL && Image->ProfileSize != 0) { |
| 244 | ifree(Image->Profile); |
| 245 | Image->Profile = NULL; |
| 246 | Image->ProfileSize = 0; |
| 247 | } |
| 248 | |
| 249 | if (Image->DxtcData != NULL && Image->DxtcFormat != IL_DXT_NO_COMP) { |
| 250 | ifree(Image->DxtcData); |
| 251 | Image->DxtcData = NULL; |
| 252 | Image->DxtcFormat = IL_DXT_NO_COMP; |
| 253 | Image->DxtcSize = 0; |
| 254 | } |
| 255 | |
| 256 | ifree(Image); |
| 257 | Image = NULL; |
| 258 | |
| 259 | return; |
| 260 | } |
no outgoing calls
no test coverage detected