diff --git a/src/rlgl.h b/src/rlgl.h index 64c7a1ab6..7eb1bb1d3 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -4993,7 +4993,8 @@ static int rlGetPixelDataSize(int width, int height, int format) default: break; } - dataSize = width*height*bpp/8; // Total data size in bytes + char bytesPerPixel = bpp/8; + dataSize = width*height*bytesPerPixel; // Total data size in bytes // Most compressed formats works on 4x4 blocks, // if texture is smaller, minimum dataSize is 8 or 16 diff --git a/src/rtextures.c b/src/rtextures.c index 60ce58f4b..94ad81e20 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -5403,7 +5403,8 @@ int GetPixelDataSize(int width, int height, int format) default: break; } - dataSize = width*height*bpp/8; // Total data size in bytes + char bytesPerPixel = bpp/8; + dataSize = width*height*bytesPerPixel; // Total data size in bytes // Most compressed formats works on 4x4 blocks, // if texture is smaller, minimum dataSize is 8 or 16