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

Function ktxTexture1_constructFromNamedFile

lib/texture1.c:481–502  ·  view source on GitHub ↗

* @memberof ktxTexture1 @private * @brief Construct a ktxTexture1 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 * initialize.

Source from the content-addressed store, hash-verified

479 * For other exceptions, see ktxTexture_constructFromStream().
480 */
481static KTX_error_code
482ktxTexture1_constructFromNamedFile(ktxTexture1* This,
483 const char* const filename,
484 ktxTextureCreateFlags createFlags)
485{
486 FILE* file;
487 ktxStream stream;
488 KTX_error_code result;
489
490 if (This == NULL || filename == NULL)
491 return KTX_INVALID_VALUE;
492
493 file = ktxFOpenUTF8(filename, "rb");
494 if (!file)
495 return KTX_FILE_OPEN_FAILED;
496
497 result = ktxFileStream_construct(&stream, file, KTX_TRUE);
498 if (result == KTX_SUCCESS)
499 result = ktxTexture1_constructFromStream(This, &stream, createFlags);
500
501 return result;
502}
503
504/**
505 * @memberof ktxTexture1 @private

Callers 1

Calls 3

ktxFOpenUTF8Function · 0.85
ktxFileStream_constructFunction · 0.85

Tested by

no test coverage detected