mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
make po2 stuff better
This commit is contained in:
@@ -21,24 +21,14 @@
|
||||
#include "ImageData.h"
|
||||
|
||||
// STD
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
// LOVE
|
||||
#include <common/Exception.h>
|
||||
#include <common/math.h>
|
||||
#include <filesystem/File.h>
|
||||
|
||||
int toPo2(int n)
|
||||
{
|
||||
n -= 1;
|
||||
n |= n >> 1;
|
||||
n |= n >> 2;
|
||||
n |= n >> 4;
|
||||
n |= n >> 8;
|
||||
n |= n >> 16;
|
||||
n |= n >> 32;
|
||||
return n+1;
|
||||
}
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace image
|
||||
@@ -54,8 +44,8 @@ namespace devil
|
||||
ilBindImage(image);
|
||||
|
||||
//scale to nearest bigger po2
|
||||
width = toPo2(width);
|
||||
height = toPo2(height);
|
||||
width = next_p2(width);
|
||||
height = next_p2(height);
|
||||
|
||||
//create and populate the image
|
||||
bool success = (ilTexImage(width, height, 1, bpp, IL_RGBA, IL_UNSIGNED_BYTE, data) == IL_TRUE);
|
||||
|
||||
@@ -23,18 +23,11 @@
|
||||
|
||||
// LOVE
|
||||
#include <filesystem/File.h>
|
||||
#include <image/Image.h>
|
||||
#include <image/ImageData.h>
|
||||
|
||||
// DevIL
|
||||
#include <IL/il.h>
|
||||
|
||||
// String
|
||||
#include <string.h>
|
||||
|
||||
// Math
|
||||
#include <math.h>
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace image
|
||||
|
||||
Reference in New Issue
Block a user