Update C sources

This commit is contained in:
Milan Nikolic 2023-11-04 13:06:19 +01:00
parent 443f35cfac
commit 15fba7e9ac
No known key found for this signature in database
GPG key ID: 9229D0EAA3AA4E75
29 changed files with 31985 additions and 22038 deletions

View file

@ -9,7 +9,7 @@
*
* Note that some file formats (DDS, PVR, KTX) also support uncompressed data storage.
* In those cases data is loaded uncompressed and format is returned.
*
*
* TODO:
* - Implement raylib function: rlGetGlTextureFormats(), required by rl_save_ktx_to_memory()
* - Review rl_load_ktx_from_memory() to support KTX v2.2 specs
@ -261,11 +261,9 @@ void *rl_load_dds_from_memory(const unsigned char *file_data, unsigned int file_
}
else if (((header->ddspf.flags == 0x04) || (header->ddspf.flags == 0x05)) && (header->ddspf.fourcc > 0)) // Compressed
{
int data_size = 0;
// Calculate data size, including all mipmaps
if (header->mipmap_count > 1) data_size = header->pitch_or_linear_size*2;
else data_size = header->pitch_or_linear_size;
// NOTE: This forces only 1 mipmap to be loaded which is not really correct but it works
int data_size = (header->pitch_or_linear_size < file_size - 0x80) ? header->pitch_or_linear_size : file_size - 0x80;
*mips = 1;
image_data = RL_MALLOC(data_size*sizeof(unsigned char));
@ -814,5 +812,4 @@ static int get_pixel_data_size(int width, int height, int format)
return data_size;
}
#endif // RL_GPUTEX_IMPLEMENTATION