summaryrefslogtreecommitdiffhomepage
path: root/src/textures.c
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2017-01-15 01:10:23 +0100
committerraysan5 <[email protected]>2017-01-15 01:10:23 +0100
commit61f6b0f707f408b89306ff1a6a2d825662ba8311 (patch)
tree91cb2122b654478c95835b248d369a9465b8a1c6 /src/textures.c
parent4a158d972d9d110fcb581bc9f6583d05a2dc2544 (diff)
downloadraylib-61f6b0f707f408b89306ff1a6a2d825662ba8311.tar.gz
raylib-61f6b0f707f408b89306ff1a6a2d825662ba8311.zip
Removed GetNextPOT(), review TraceLog()
Diffstat (limited to 'src/textures.c')
-rw-r--r--src/textures.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/textures.c b/src/textures.c
index 6538c316..3fa250c2 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -758,9 +758,10 @@ void ImageToPOT(Image *image, Color fillColor)
{
Color *pixels = GetImageData(*image); // Get pixels data
- // Just add the required amount of pixels at the right and bottom sides of image...
- int potWidth = GetNextPOT(image->width);
- int potHeight = GetNextPOT(image->height);
+ // Calculate next power-of-two values
+ // NOTE: Just add the required amount of pixels at the right and bottom sides of image...
+ int potWidth = (int)powf(2, ceilf(logf((float)image->width)/logf(2)));
+ int potHeight = (int)powf(2, ceilf(logf((float)image->height)/logf(2)));
// Check if POT texture generation is required (if texture is not already POT)
if ((potWidth != image->width) || (potHeight != image->height))
@@ -1342,8 +1343,9 @@ void ImageColorBrightness(Image *image, int brightness)
void GenTextureMipmaps(Texture2D *texture)
{
#if PLATFORM_WEB
- int potWidth = GetNextPOT(texture->width);
- int potHeight = GetNextPOT(texture->height);
+ // Calculate next power-of-two values
+ int potWidth = (int)powf(2, ceilf(logf((float)texture->width)/logf(2)));
+ int potHeight = (int)powf(2, ceilf(logf((float)texture->height)/logf(2)));
// Check if texture is POT
if ((potWidth != texture->width) || (potHeight != texture->height))