| 757 | |
| 758 | |
| 759 | void ILAPIENTRY ilSetPixels(ILint XOff, ILint YOff, ILint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, void *Data) |
| 760 | { |
| 761 | void *Converted; |
| 762 | |
| 763 | if (iCurImage == NULL) { |
| 764 | ilSetError(IL_ILLEGAL_OPERATION); |
| 765 | return; |
| 766 | } |
| 767 | if (Data == NULL) { |
| 768 | ilSetError(IL_INVALID_PARAM); |
| 769 | return; |
| 770 | } |
| 771 | |
| 772 | if (Format == iCurImage->Format && Type == iCurImage->Type) { |
| 773 | Converted = (void*)Data; |
| 774 | } |
| 775 | else { |
| 776 | Converted = ilConvertBuffer(Width * Height * Depth * ilGetBppFormat(Format) * ilGetBpcType(Type), Format, iCurImage->Format, Type, iCurImage->Type, NULL, Data); |
| 777 | if (!Converted) |
| 778 | return; |
| 779 | } |
| 780 | |
| 781 | if (YOff + Height <= 1) { |
| 782 | ilSetPixels1D(XOff, Width, Converted); |
| 783 | } |
| 784 | else if (ZOff + Depth <= 1) { |
| 785 | ilSetPixels2D(XOff, YOff, Width, Height, Converted); |
| 786 | } |
| 787 | else { |
| 788 | ilSetPixels3D(XOff, YOff, ZOff, Width, Height, Depth, Converted); |
| 789 | } |
| 790 | |
| 791 | if (Format == iCurImage->Format && Type == iCurImage->Type) { |
| 792 | return; |
| 793 | } |
| 794 | |
| 795 | if (Converted != Data) |
| 796 | ifree(Converted); |
| 797 | |
| 798 | return; |
| 799 | } |
| 800 | |
| 801 | |
| 802 |
nothing calls this directly
no test coverage detected