| 456 | |
| 457 | |
| 458 | ILuint ILAPIENTRY ilCreateSubImage(ILenum Type, ILuint Num) |
| 459 | { |
| 460 | ILimage *SubImage; |
| 461 | ILuint Count ; // Create one before we go in the loop. |
| 462 | |
| 463 | if (iCurImage == NULL) { |
| 464 | ilSetError(IL_ILLEGAL_OPERATION); |
| 465 | return 0; |
| 466 | } |
| 467 | if (Num == 0) { |
| 468 | return 0; |
| 469 | } |
| 470 | |
| 471 | switch (Type) |
| 472 | { |
| 473 | case IL_SUB_NEXT: |
| 474 | if (iCurImage->Next) |
| 475 | ilCloseImage(iCurImage->Next); |
| 476 | iCurImage->Next = ilNewImage(1, 1, 1, 1, 1); |
| 477 | SubImage = iCurImage->Next; |
| 478 | break; |
| 479 | |
| 480 | case IL_SUB_MIPMAP: |
| 481 | if (iCurImage->Mipmaps) |
| 482 | ilCloseImage(iCurImage->Mipmaps); |
| 483 | iCurImage->Mipmaps = ilNewImage(1, 1, 1, 1, 1); |
| 484 | SubImage = iCurImage->Mipmaps; |
| 485 | break; |
| 486 | |
| 487 | case IL_SUB_LAYER: |
| 488 | if (iCurImage->Layers) |
| 489 | ilCloseImage(iCurImage->Layers); |
| 490 | iCurImage->Layers = ilNewImage(1, 1, 1, 1, 1); |
| 491 | SubImage = iCurImage->Layers; |
| 492 | break; |
| 493 | |
| 494 | default: |
| 495 | ilSetError(IL_INVALID_ENUM); |
| 496 | return IL_FALSE; |
| 497 | } |
| 498 | |
| 499 | if (SubImage == NULL) { |
| 500 | return 0; |
| 501 | } |
| 502 | |
| 503 | for (Count = 1; Count < Num; Count++) { |
| 504 | SubImage->Next = ilNewImage(1, 1, 1, 1, 1); |
| 505 | SubImage = SubImage->Next; |
| 506 | if (SubImage == NULL) |
| 507 | return Count; |
| 508 | } |
| 509 | |
| 510 | return Count; |
| 511 | } |
| 512 | |
| 513 | |
| 514 | // Returns the current index. |
nothing calls this directly
no test coverage detected