REVIEWED: rlLoadTexture()
#3440
This commit is contained in:
parent
fc6152613f
commit
19ff0e5fb1
1 changed files with 3 additions and 2 deletions
|
@ -3000,7 +3000,8 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format,
|
||||||
int mipOffset = 0; // Mipmap data offset, only used for tracelog
|
int mipOffset = 0; // Mipmap data offset, only used for tracelog
|
||||||
|
|
||||||
// NOTE: Added pointer math separately from function to avoid UBSAN complaining
|
// NOTE: Added pointer math separately from function to avoid UBSAN complaining
|
||||||
unsigned char *dataPtr = (unsigned char *)data;
|
unsigned char *dataPtr = NULL;
|
||||||
|
if (data != NULL) dataPtr = (unsigned char *)data;
|
||||||
|
|
||||||
// Load the different mipmap levels
|
// Load the different mipmap levels
|
||||||
for (int i = 0; i < mipmapCount; i++)
|
for (int i = 0; i < mipmapCount; i++)
|
||||||
|
@ -3040,7 +3041,7 @@ unsigned int rlLoadTexture(const void *data, int width, int height, int format,
|
||||||
mipWidth /= 2;
|
mipWidth /= 2;
|
||||||
mipHeight /= 2;
|
mipHeight /= 2;
|
||||||
mipOffset += mipSize; // Increment offset position to next mipmap
|
mipOffset += mipSize; // Increment offset position to next mipmap
|
||||||
dataPtr += mipSize; // Increment data pointer to next mipmap
|
if (data != NULL) dataPtr += mipSize; // Increment data pointer to next mipmap
|
||||||
|
|
||||||
// Security check for NPOT textures
|
// Security check for NPOT textures
|
||||||
if (mipWidth < 1) mipWidth = 1;
|
if (mipWidth < 1) mipWidth = 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue