Copies everything but the Data from Src to Dest.
| 956 | |
| 957 | // Copies everything but the Data from Src to Dest. |
| 958 | ILAPI ILboolean ILAPIENTRY ilCopyImageAttr(ILimage *Dest, ILimage *Src) |
| 959 | { |
| 960 | if (Dest == NULL || Src == NULL) { |
| 961 | ilSetError(IL_INVALID_PARAM); |
| 962 | return IL_FALSE; |
| 963 | } |
| 964 | |
| 965 | if (Dest->Pal.Palette && Dest->Pal.PalSize && Dest->Pal.PalType != IL_PAL_NONE) { |
| 966 | ifree(Dest->Pal.Palette); |
| 967 | Dest->Pal.Palette = NULL; |
| 968 | } |
| 969 | if (Dest->Faces) { |
| 970 | ilCloseImage(Dest->Faces); |
| 971 | Dest->Faces = NULL; |
| 972 | } |
| 973 | if (Dest->Layers) { |
| 974 | ilCloseImage(Dest->Layers); |
| 975 | Dest->Layers = NULL; |
| 976 | } |
| 977 | if (Dest->Mipmaps) { |
| 978 | ilCloseImage(Dest->Mipmaps); |
| 979 | Dest->Mipmaps = NULL; |
| 980 | } |
| 981 | if (Dest->Next) { |
| 982 | ilCloseImage(Dest->Next); |
| 983 | Dest->Next = NULL; |
| 984 | } |
| 985 | if (Dest->Profile) { |
| 986 | ifree(Dest->Profile); |
| 987 | Dest->Profile = NULL; |
| 988 | Dest->ProfileSize = 0; |
| 989 | } |
| 990 | if (Dest->DxtcData) { |
| 991 | ifree(Dest->DxtcData); |
| 992 | Dest->DxtcData = NULL; |
| 993 | Dest->DxtcFormat = IL_DXT_NO_COMP; |
| 994 | Dest->DxtcSize = 0; |
| 995 | } |
| 996 | |
| 997 | if (Src->AnimList && Src->AnimSize) { |
| 998 | Dest->AnimList = (ILuint*)ialloc(Src->AnimSize * sizeof(ILuint)); |
| 999 | if (Dest->AnimList == NULL) { |
| 1000 | return IL_FALSE; |
| 1001 | } |
| 1002 | memcpy(Dest->AnimList, Src->AnimList, Src->AnimSize * sizeof(ILuint)); |
| 1003 | } |
| 1004 | if (Src->Profile) { |
| 1005 | Dest->Profile = (ILubyte*)ialloc(Src->ProfileSize); |
| 1006 | if (Dest->Profile == NULL) { |
| 1007 | return IL_FALSE; |
| 1008 | } |
| 1009 | memcpy(Dest->Profile, Src->Profile, Src->ProfileSize); |
| 1010 | Dest->ProfileSize = Src->ProfileSize; |
| 1011 | } |
| 1012 | if (Src->Pal.Palette) { |
| 1013 | Dest->Pal.Palette = (ILubyte*)ialloc(Src->Pal.PalSize); |
| 1014 | if (Dest->Pal.Palette == NULL) { |
| 1015 | return IL_FALSE; |
no test coverage detected