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

Function ktxTexture1_WriteToMemory

lib/writer1.c:469–503  ·  view source on GitHub ↗

* @memberof ktxTexture1 * @~English * @brief Write a ktxTexture object to block of memory in KTX format. * * Memory is allocated by the function and the caller is responsible for * freeing it. * * @param[in] This pointer to the target ktxTexture object. * @param[in,out] ppDstBytes pointer to location to write the address of * the destination memory. The

Source from the content-addressed store, hash-verified

467 * An error occurred while writing the file.
468 */
469KTX_error_code
470ktxTexture1_WriteToMemory(ktxTexture1* This,
471 ktx_uint8_t** ppDstBytes, ktx_size_t* pSize)
472{
473 struct ktxStream dststr;
474 KTX_error_code result;
475 ktx_size_t strSize;
476
477 if (!This || !ppDstBytes || !pSize)
478 return KTX_INVALID_VALUE;
479
480 *ppDstBytes = NULL;
481
482 result = ktxMemStream_construct(&dststr, KTX_FALSE);
483 if (result != KTX_SUCCESS)
484 return result;
485
486 result = ktxTexture1_WriteToStream(This, &dststr);
487 if(result != KTX_SUCCESS)
488 {
489 ktxMemStream_destruct(&dststr);
490 return result;
491 }
492
493 ktxMemStream_getdata(&dststr, ppDstBytes);
494 dststr.getsize(&dststr, &strSize);
495 *pSize = (GLsizei)strSize;
496 /* This function does not free the memory pointed at by the
497 * value obtained from ktxMemStream_getdata() thanks to the
498 * KTX_FALSE passed to the constructor above.
499 */
500 ktxMemStream_destruct(&dststr);
501 return KTX_SUCCESS;
502
503}
504
505ktx_uint32_t lcm4(uint32_t a);
506KTX_error_code appendLibId(ktxHashList* head,

Callers 2

runTestMethod · 0.50
TEST_FFunction · 0.50

Calls 5

ktxMemStream_constructFunction · 0.85
ktxMemStream_destructFunction · 0.85
ktxMemStream_getdataFunction · 0.85
getsizeMethod · 0.45

Tested by 2

runTestMethod · 0.40
TEST_FFunction · 0.40