MCPcopy Create free account
hub / github.com/DentonW/DevIL / ILAPIENTRY ilTexImageSurface_

Function ILAPIENTRY ilTexImageSurface_

DevIL/src-IL/src/il_devil.cpp:188–241  ·  view source on GitHub ↗

Internal version of ilTexImageSurface.

Source from the content-addressed store, hash-verified

186
187// Internal version of ilTexImageSurface.
188ILboolean ILAPIENTRY ilTexImageSurface_(ILimage *Image, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, void *Data)
189{
190 ILimage* mips;
191 ILimage* next;
192 ILimage* faces;
193 ILimage* layers;
194 ILenum flags;
195 ILenum origin;
196 ILboolean retval;
197
198 if (Image == NULL) {
199 ilSetError(IL_ILLEGAL_OPERATION);
200 return IL_FALSE;
201 }
202
203 ////
204
205 // Not sure if we should be getting rid of the palette...
206 if (Image->Pal.Palette && Image->Pal.PalSize && Image->Pal.PalType != IL_PAL_NONE) {
207 ifree(Image->Pal.Palette);
208 }
209
210 if (Image->AnimList) ifree(Image->AnimList);
211 if (Image->Profile) ifree(Image->Profile);
212 if (Image->DxtcData) ifree(Image->DxtcData);
213 if (Image->Data) ifree(Image->Data);
214
215 ////
216
217 //@TODO: Also check against format?
218 /*if (Width == 0 || Height == 0 || Depth == 0 || Bpp == 0) {
219 ilSetError(IL_INVALID_PARAM);
220 return IL_FALSE;
221 }*/
222
223 mips = Image->Mipmaps;
224 next = Image->Next;
225 faces = Image->Faces;
226 layers = Image->Layers;
227 flags = Image->CubeFlags;
228 origin = Image->Origin;
229
230 retval = ilInitImage(Image, Width, Height, Depth, Bpp, Format, Type, Data);
231
232 // reset our chains
233 Image->Mipmaps = mips;
234 Image->Next = next;
235 Image->Faces = faces;
236 Image->Layers = layers;
237 Image->CubeFlags = flags;
238 Image->Origin = origin;
239
240 return retval;
241}
242
243
244//! Uploads Data of the same size to replace the current image's data.

Callers

nothing calls this directly

Calls 2

ilSetErrorFunction · 0.85
ilInitImageFunction · 0.85

Tested by

no test coverage detected