MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / ktxTexture2_constructFromNamedFile

Function ktxTexture2_constructFromNamedFile

lib/texture2.c:1169–1190  ·  view source on GitHub ↗

* @memberof ktxTexture2 @private * @~English * @brief Construct a ktxTexture from a named KTX file. * * The file name must be encoded in utf-8. On Windows convert unicode names * to utf-8 with @c WideCharToMultiByte(CP_UTF8, ...) before calling. * * See ktxTextureInt_constructFromStream for details. * * @param[in] This pointer to a ktxTextureInt-sized block of memory to *

Source from the content-addressed store, hash-verified

1167 * For other exceptions, see ktxTexture_constructFromStream().
1168 */
1169static KTX_error_code
1170ktxTexture2_constructFromNamedFile(ktxTexture2* This,
1171 const char* const filename,
1172 ktxTextureCreateFlags createFlags)
1173{
1174 KTX_error_code result;
1175 ktxStream stream;
1176 FILE* file;
1177
1178 if (This == NULL || filename == NULL)
1179 return KTX_INVALID_VALUE;
1180
1181 file = ktxFOpenUTF8(filename, "rb");
1182 if (!file)
1183 return KTX_FILE_OPEN_FAILED;
1184
1185 result = ktxFileStream_construct(&stream, file, KTX_TRUE);
1186 if (result == KTX_SUCCESS)
1187 result = ktxTexture2_constructFromStream(This, &stream, createFlags);
1188
1189 return result;
1190}
1191
1192/**
1193 * @memberof ktxTexture2 @private

Callers 1

Calls 3

ktxFOpenUTF8Function · 0.85
ktxFileStream_constructFunction · 0.85

Tested by

no test coverage detected