mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Added the ability to use custom mipmaps in Images, via love.graphics.newImage(filename, {mipmap1, mipmap2, ...}). Resolves issue #1064.
All mipmap levels must be present if custom mipmaps are used (and their sizes must be half the size of the previous mipmap level, rounded down.) Image:getData now returns all custom mipmaps in an Image.
This commit is contained in:
@@ -92,13 +92,26 @@ int w_Image_refresh(lua_State *L)
|
||||
int w_Image_getData(lua_State *L)
|
||||
{
|
||||
Image *i = luax_checkimage(L, 1);
|
||||
int n = 0;
|
||||
|
||||
if (i->isCompressed())
|
||||
luax_pushtype(L, IMAGE_COMPRESSED_IMAGE_DATA_ID, i->getCompressedData());
|
||||
{
|
||||
for (const auto &cdata : i->getCompressedData())
|
||||
{
|
||||
luax_pushtype(L, IMAGE_COMPRESSED_IMAGE_DATA_ID, cdata.get());
|
||||
n++;
|
||||
}
|
||||
}
|
||||
else
|
||||
luax_pushtype(L, IMAGE_IMAGE_DATA_ID, i->getImageData());
|
||||
{
|
||||
for (const auto &data : i->getImageData())
|
||||
{
|
||||
luax_pushtype(L, IMAGE_IMAGE_DATA_ID, data.get());
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
return n;
|
||||
}
|
||||
|
||||
static const char *imageFlagName(Image::FlagType flagtype)
|
||||
|
||||
Reference in New Issue
Block a user