mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-27 23:34:29 +00:00
imagelib: fix for loop scope
This commit is contained in:
parent
b0bbcab6b4
commit
c082e46662
@ -70,6 +70,7 @@ static qboolean Image_KTX2Parse( const ktx2_header_t *header, const byte *buffer
|
|||||||
ktx2_index_t index;
|
ktx2_index_t index;
|
||||||
size_t total_size = 0;
|
size_t total_size = 0;
|
||||||
size_t max_offset = 0;
|
size_t max_offset = 0;
|
||||||
|
int mip, cursor;
|
||||||
const byte *const levels_begin = buffer + KTX2_LEVELS_OFFSET;
|
const byte *const levels_begin = buffer + KTX2_LEVELS_OFFSET;
|
||||||
|
|
||||||
// Sets image.type and image.flags
|
// Sets image.type and image.flags
|
||||||
@ -125,7 +126,7 @@ static qboolean Image_KTX2Parse( const ktx2_header_t *header, const byte *buffer
|
|||||||
|
|
||||||
memcpy( &index, buffer + KTX2_IDENTIFIER_SIZE + sizeof( ktx2_header_t ), sizeof( index ));
|
memcpy( &index, buffer + KTX2_IDENTIFIER_SIZE + sizeof( ktx2_header_t ), sizeof( index ));
|
||||||
|
|
||||||
for( int mip = 0; mip < header->levelCount; ++mip )
|
for( mip = 0; mip < header->levelCount; ++mip )
|
||||||
{
|
{
|
||||||
const uint32_t width = Q_max( 1, ( header->pixelWidth >> mip ));
|
const uint32_t width = Q_max( 1, ( header->pixelWidth >> mip ));
|
||||||
const uint32_t height = Q_max( 1, ( header->pixelHeight >> mip ));
|
const uint32_t height = Q_max( 1, ( header->pixelHeight >> mip ));
|
||||||
@ -154,7 +155,7 @@ static qboolean Image_KTX2Parse( const ktx2_header_t *header, const byte *buffer
|
|||||||
image.rgba = Mem_Malloc( host.imagepool, image.size );
|
image.rgba = Mem_Malloc( host.imagepool, image.size );
|
||||||
memcpy( image.rgba, buffer, image.size );
|
memcpy( image.rgba, buffer, image.size );
|
||||||
|
|
||||||
for( int mip = 0, cursor = 0; mip < header->levelCount; ++mip )
|
for( mip = 0, cursor = 0; mip < header->levelCount; ++mip )
|
||||||
{
|
{
|
||||||
ktx2_level_t level;
|
ktx2_level_t level;
|
||||||
memcpy( &level, levels_begin + mip * sizeof( level ), sizeof( level ));
|
memcpy( &level, levels_begin + mip * sizeof( level ), sizeof( level ));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user