* @memberof ktxTexture2 * @~English * @brief Return the total size in bytes of the uncompressed data of a * ktxTexture2. * * If supercompressionScheme == @c KTX_SS_NONE or * @c KTX_SS_BASIS_LZ, returns the value of @c This->dataSize * else if supercompressionScheme == @c KTX_SS_ZSTD or @c KTX_SS_ZLIB, it * returns the sum of the uncompressed sizes of each mip level plus space for *
| 2124 | * @param[in] This pointer to the ktxTexture1 object of interest. |
| 2125 | */ |
| 2126 | ktx_size_t |
| 2127 | ktxTexture2_GetDataSizeUncompressed(ktxTexture2* This) |
| 2128 | { |
| 2129 | switch (This->supercompressionScheme) { |
| 2130 | case KTX_SS_BASIS_LZ: |
| 2131 | case KTX_SS_NONE: |
| 2132 | return This->dataSize; |
| 2133 | case KTX_SS_ZSTD: |
| 2134 | case KTX_SS_ZLIB: |
| 2135 | { |
| 2136 | ktx_size_t uncompressedSize = 0; |
| 2137 | ktx_uint32_t uncompressedLevelAlignment; |
| 2138 | ktxLevelIndexEntry* levelIndex = This->_private->_levelIndex; |
| 2139 | |
| 2140 | uncompressedLevelAlignment = |
| 2141 | ktxTexture2_calcPostInflationLevelAlignment(This); |
| 2142 | |
| 2143 | for (ktx_int32_t level = This->numLevels - 1; level >= 1; level--) { |
| 2144 | ktx_size_t uncompressedLevelSize; |
| 2145 | uncompressedLevelSize = levelIndex[level].uncompressedByteLength; |
| 2146 | uncompressedLevelSize = _KTX_PADN(uncompressedLevelAlignment, |
| 2147 | uncompressedLevelSize); |
| 2148 | uncompressedSize += uncompressedLevelSize; |
| 2149 | } |
| 2150 | uncompressedSize += levelIndex[0].uncompressedByteLength; |
| 2151 | return uncompressedSize; |
| 2152 | } |
| 2153 | case KTX_SS_BEGIN_VENDOR_RANGE: |
| 2154 | case KTX_SS_END_VENDOR_RANGE: |
| 2155 | case KTX_SS_BEGIN_RESERVED: |
| 2156 | default: |
| 2157 | return 0; |
| 2158 | } |
| 2159 | } |
| 2160 | |
| 2161 | /** |
| 2162 | * @memberof ktxTexture2 |
no test coverage detected