// ONLY call at startup. ILvoid ILAPIENTRY ilInit() { // if it is already initialized skip initialization if (IsInit == IL_TRUE ) return; //ilSetMemory(NULL, NULL); Now useless 3/4/2006 (due to modification in il_alloc.c) ilSetError(IL_NO_ERROR); ilDefaultStates(); // Set states to their defaults. // Sets default file-reading callbacks. ilResetRead(); ilResetWrite(); #if (!defined(_WIN32_WCE)) && (!defined(IL_STATIC_LIB)) atexit((void*)ilRemoveRegistered); #endif //_WIN32_WCE //ilShutDown(); iSetImage0(); // Beware! Clears all existing textures! iBindImageTemp(); // Go ahead and create the temporary image. IsInit = IL_TRUE; return; }
//! Pushes the states indicated by Bits onto the state stack void ILAPIENTRY ilPushAttrib(ILuint Bits) { // Should we check here to see if ilCurrentPos is negative? if (ilCurrentPos >= IL_ATTRIB_STACK_MAX - 1) { ilCurrentPos = IL_ATTRIB_STACK_MAX - 1; ilSetError(IL_STACK_OVERFLOW); return; } ilCurrentPos++; // memcpy(&ilStates[ilCurrentPos], &ilStates[ilCurrentPos - 1], sizeof(IL_STATES)); ilDefaultStates(); if (Bits & IL_ORIGIN_BIT) { ilStates[ilCurrentPos].ilOriginMode = ilStates[ilCurrentPos-1].ilOriginMode; ilStates[ilCurrentPos].ilOriginSet = ilStates[ilCurrentPos-1].ilOriginSet; } if (Bits & IL_FORMAT_BIT) { ilStates[ilCurrentPos].ilFormatMode = ilStates[ilCurrentPos-1].ilFormatMode; ilStates[ilCurrentPos].ilFormatSet = ilStates[ilCurrentPos-1].ilFormatSet; } if (Bits & IL_TYPE_BIT) { ilStates[ilCurrentPos].ilTypeMode = ilStates[ilCurrentPos-1].ilTypeMode; ilStates[ilCurrentPos].ilTypeSet = ilStates[ilCurrentPos-1].ilTypeSet; } if (Bits & IL_FILE_BIT) { ilStates[ilCurrentPos].ilOverWriteFiles = ilStates[ilCurrentPos-1].ilOverWriteFiles; } if (Bits & IL_PAL_BIT) { ilStates[ilCurrentPos].ilAutoConvPal = ilStates[ilCurrentPos-1].ilAutoConvPal; } if (Bits & IL_LOADFAIL_BIT) { ilStates[ilCurrentPos].ilDefaultOnFail = ilStates[ilCurrentPos-1].ilDefaultOnFail; } if (Bits & IL_COMPRESS_BIT) { ilStates[ilCurrentPos].ilCompression = ilStates[ilCurrentPos-1].ilCompression; } if (Bits & IL_FORMAT_SPECIFIC_BIT) { ilStates[ilCurrentPos].ilTgaCreateStamp = ilStates[ilCurrentPos-1].ilTgaCreateStamp; ilStates[ilCurrentPos].ilJpgQuality = ilStates[ilCurrentPos-1].ilJpgQuality; ilStates[ilCurrentPos].ilPngInterlace = ilStates[ilCurrentPos-1].ilPngInterlace; ilStates[ilCurrentPos].ilTgaRle = ilStates[ilCurrentPos-1].ilTgaRle; ilStates[ilCurrentPos].ilBmpRle = ilStates[ilCurrentPos-1].ilBmpRle; ilStates[ilCurrentPos].ilSgiRle = ilStates[ilCurrentPos-1].ilSgiRle; ilStates[ilCurrentPos].ilJpgFormat = ilStates[ilCurrentPos-1].ilJpgFormat; ilStates[ilCurrentPos].ilDxtcFormat = ilStates[ilCurrentPos-1].ilDxtcFormat; ilStates[ilCurrentPos].ilPcdPicNum = ilStates[ilCurrentPos-1].ilPcdPicNum; ilStates[ilCurrentPos].ilPngAlphaIndex = ilStates[ilCurrentPos-1].ilPngAlphaIndex; // Strings if (ilStates[ilCurrentPos].ilTgaId) ifree(ilStates[ilCurrentPos].ilTgaId); if (ilStates[ilCurrentPos].ilTgaAuthName) ifree(ilStates[ilCurrentPos].ilTgaAuthName); if (ilStates[ilCurrentPos].ilTgaAuthComment) ifree(ilStates[ilCurrentPos].ilTgaAuthComment); if (ilStates[ilCurrentPos].ilPngAuthName) ifree(ilStates[ilCurrentPos].ilPngAuthName); if (ilStates[ilCurrentPos].ilPngTitle) ifree(ilStates[ilCurrentPos].ilPngTitle); if (ilStates[ilCurrentPos].ilPngDescription) ifree(ilStates[ilCurrentPos].ilPngDescription); //2003-09-01: added tif strings if (ilStates[ilCurrentPos].ilTifDescription) ifree(ilStates[ilCurrentPos].ilTifDescription); if (ilStates[ilCurrentPos].ilTifHostComputer) ifree(ilStates[ilCurrentPos].ilTifHostComputer); if (ilStates[ilCurrentPos].ilTifDocumentName) ifree(ilStates[ilCurrentPos].ilTifDocumentName); if (ilStates[ilCurrentPos].ilTifAuthName) ifree(ilStates[ilCurrentPos].ilTifAuthName); if (ilStates[ilCurrentPos].ilCHeader) ifree(ilStates[ilCurrentPos].ilCHeader); ilStates[ilCurrentPos].ilTgaId = _strdup(ilStates[ilCurrentPos-1].ilTgaId); ilStates[ilCurrentPos].ilTgaAuthName = _strdup(ilStates[ilCurrentPos-1].ilTgaAuthName); ilStates[ilCurrentPos].ilTgaAuthComment = _strdup(ilStates[ilCurrentPos-1].ilTgaAuthComment); ilStates[ilCurrentPos].ilPngAuthName = _strdup(ilStates[ilCurrentPos-1].ilPngAuthName); ilStates[ilCurrentPos].ilPngTitle = _strdup(ilStates[ilCurrentPos-1].ilPngTitle); ilStates[ilCurrentPos].ilPngDescription = _strdup(ilStates[ilCurrentPos-1].ilPngDescription); //2003-09-01: added tif strings ilStates[ilCurrentPos].ilTifDescription = _strdup(ilStates[ilCurrentPos-1].ilTifDescription); ilStates[ilCurrentPos].ilTifHostComputer = _strdup(ilStates[ilCurrentPos-1].ilTifHostComputer); ilStates[ilCurrentPos].ilTifDocumentName = _strdup(ilStates[ilCurrentPos-1].ilTifDocumentName); ilStates[ilCurrentPos].ilTifAuthName = _strdup(ilStates[ilCurrentPos-1].ilTifAuthName); ilStates[ilCurrentPos].ilCHeader = _strdup(ilStates[ilCurrentPos-1].ilCHeader); } return; }