Internal function to figure out where we are in an image chain. @TODO: This may get much more complex with mipmaps under faces, etc.
| 346 | //! Internal function to figure out where we are in an image chain. |
| 347 | //@TODO: This may get much more complex with mipmaps under faces, etc. |
| 348 | ILuint iGetActiveNum(ILenum Type) |
| 349 | { |
| 350 | ILimage *BaseImage; |
| 351 | ILuint Num = 0; |
| 352 | |
| 353 | if (iCurImage == NULL) { |
| 354 | ilSetError(IL_ILLEGAL_OPERATION); |
| 355 | return 0; |
| 356 | } |
| 357 | |
| 358 | BaseImage = iGetBaseImage(); |
| 359 | if (BaseImage == iCurImage) |
| 360 | return 0; |
| 361 | |
| 362 | switch (Type) |
| 363 | { |
| 364 | case IL_ACTIVE_IMAGE: |
| 365 | BaseImage = BaseImage->Next; |
| 366 | do { |
| 367 | if (BaseImage == NULL) |
| 368 | return 0; |
| 369 | Num++; |
| 370 | if (BaseImage == iCurImage) |
| 371 | return Num; |
| 372 | } while ((BaseImage = BaseImage->Next)); |
| 373 | break; |
| 374 | case IL_ACTIVE_MIPMAP: |
| 375 | BaseImage = BaseImage->Mipmaps; |
| 376 | do { |
| 377 | if (BaseImage == NULL) |
| 378 | return 0; |
| 379 | Num++; |
| 380 | if (BaseImage == iCurImage) |
| 381 | return Num; |
| 382 | } while ((BaseImage = BaseImage->Mipmaps)); |
| 383 | break; |
| 384 | case IL_ACTIVE_LAYER: |
| 385 | BaseImage = BaseImage->Layers; |
| 386 | do { |
| 387 | if (BaseImage == NULL) |
| 388 | return 0; |
| 389 | Num++; |
| 390 | if (BaseImage == iCurImage) |
| 391 | return Num; |
| 392 | } while ((BaseImage = BaseImage->Layers)); |
| 393 | break; |
| 394 | case IL_ACTIVE_FACE: |
| 395 | BaseImage = BaseImage->Faces; |
| 396 | do { |
| 397 | if (BaseImage == NULL) |
| 398 | return 0; |
| 399 | Num++; |
| 400 | if (BaseImage == iCurImage) |
| 401 | return Num; |
| 402 | } while ((BaseImage = BaseImage->Faces)); |
| 403 | break; |
| 404 | } |
| 405 |
no test coverage detected