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

Function ktxTexture1_constructFromMemory

lib/texture1.c:522–538  ·  view source on GitHub ↗

* @memberof ktxTexture1 @private * @brief Construct a ktxTexture1 from KTX-formatted data in memory. * * See ktxTextureInt_constructFromStream for details. * * @param[in] This pointer to a ktxTextureInt-sized block of memory to * initialize. * @param[in] bytes pointer to the memory containing the serialized KTX data. * @param[in] size length of the KTX data in bytes. *

Source from the content-addressed store, hash-verified

520 * For other exceptions, see ktxTexture_constructFromStream().
521 */
522static KTX_error_code
523ktxTexture1_constructFromMemory(ktxTexture1* This,
524 const ktx_uint8_t* bytes, ktx_size_t size,
525 ktxTextureCreateFlags createFlags)
526{
527 ktxStream stream;
528 KTX_error_code result;
529
530 if (bytes == NULL || size == 0)
531 return KTX_INVALID_VALUE;
532
533 result = ktxMemStream_construct_ro(&stream, bytes, size);
534 if (result == KTX_SUCCESS)
535 result = ktxTexture1_constructFromStream(This, &stream, createFlags);
536
537 return result;
538}
539
540void
541ktxTexture1_destruct(ktxTexture1* This)

Callers 1

Calls 2

Tested by

no test coverage detected