mirror of
https://github.com/love2d/love.git
synced 2026-08-20 20:49:54 +02:00
love.image.newImageData(w, h, format, rawbytes) can accept a Data object.
--HG-- branch : minor
This commit is contained in:
@@ -56,7 +56,13 @@ int w_newImageData(lua_State *L)
|
|||||||
size_t numbytes = 0;
|
size_t numbytes = 0;
|
||||||
const char *bytes = nullptr;
|
const char *bytes = nullptr;
|
||||||
|
|
||||||
if (!lua_isnoneornil(L, 4))
|
if (luax_istype(L, 4, Data::type))
|
||||||
|
{
|
||||||
|
Data *data = luax_checkdata(L, 4);
|
||||||
|
bytes = (const char *) data->getData();
|
||||||
|
numbytes = data->getSize();
|
||||||
|
}
|
||||||
|
else if (!lua_isnoneornil(L, 4))
|
||||||
bytes = luaL_checklstring(L, 4, &numbytes);
|
bytes = luaL_checklstring(L, 4, &numbytes);
|
||||||
|
|
||||||
ImageData *t = nullptr;
|
ImageData *t = nullptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user