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

Function ktxTexture2_calcLevelOffset

lib/texture2.c:1677–1692  ·  view source on GitHub ↗

* @memberof ktxTexture2 @private * @~English * @brief Return the offset of a level in bytes from the start of the image * data in a ktxTexture. * * Since the offset is from the start of the image data, it does not include the initial * @c mipPadding required in the file. * * @param[in] This pointer to the ktxTexture object of interest. * @param[in] level level whose offset

Source from the content-addressed store, hash-verified

1675 * @return the data size in bytes.
1676 */
1677ktx_size_t
1678ktxTexture2_calcLevelOffset(ktxTexture2* This, ktx_uint32_t level)
1679{
1680 assert (This != NULL);
1681 assert(This->supercompressionScheme == KTX_SS_NONE);
1682 assert (level < This->numLevels);
1683 ktx_size_t levelOffset = 0;
1684 for (ktx_uint32_t i = This->numLevels - 1; i > level; i--) {
1685 ktx_size_t levelSize;
1686 levelSize = ktxTexture_calcLevelSize(ktxTexture(This), i,
1687 KTX_FORMAT_VERSION_TWO);
1688 levelOffset += _KTX_PADN(This->_private->_requiredLevelAlignment,
1689 levelSize);
1690 }
1691 return levelOffset;
1692}
1693
1694
1695/**

Callers 1

TESTFunction · 0.85

Calls 2

assertFunction · 0.85
ktxTexture_calcLevelSizeFunction · 0.85

Tested by 1

TESTFunction · 0.68