* @memberof ktxTexture2 * @ingroup writer * @~English * @brief Create a ktxTexture2 by making a copy of a ktxTexture2. * * The address of the newly created ktxTexture2 is written to the location * pointed at by @p newTex. * * @param[in] orig pointer to the texture to copy. * @param[in,out] newTex pointer to a location in which store the address of * the newly
| 1335 | * @exception KTX_OUT_OF_MEMORY Not enough memory for the texture data. |
| 1336 | */ |
| 1337 | KTX_error_code |
| 1338 | ktxTexture2_CreateCopy(ktxTexture2* orig, ktxTexture2** newTex) |
| 1339 | { |
| 1340 | KTX_error_code result; |
| 1341 | |
| 1342 | if (newTex == NULL) |
| 1343 | return KTX_INVALID_VALUE; |
| 1344 | |
| 1345 | ktxTexture2* tex = (ktxTexture2*)malloc(sizeof(ktxTexture2)); |
| 1346 | if (tex == NULL) |
| 1347 | return KTX_OUT_OF_MEMORY; |
| 1348 | |
| 1349 | result = ktxTexture2_constructCopy(tex, orig); |
| 1350 | if (result != KTX_SUCCESS) { |
| 1351 | free(tex); |
| 1352 | } else { |
| 1353 | *newTex = tex; |
| 1354 | } |
| 1355 | return result; |
| 1356 | |
| 1357 | } |
| 1358 | |
| 1359 | /** |
| 1360 | * @defgroup reader Reader |