mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Added optional xoffset/yoffset/width/height arguments to Image:refresh, to specify a sub-rectangle. Specifying a small sub-rectangle can improve the performance of Image:refresh.
--HG-- branch : minor
This commit is contained in:
@@ -79,7 +79,13 @@ int w_Image_isCompressed(lua_State *L)
|
||||
int w_Image_refresh(lua_State *L)
|
||||
{
|
||||
Image *i = luax_checkimage(L, 1);
|
||||
luax_catchexcept(L, [&](){ i->refresh(); });
|
||||
|
||||
int xoffset = luaL_optint(L, 2, 0);
|
||||
int yoffset = luaL_optint(L, 3, 0);
|
||||
int w = luaL_optint(L, 4, i->getWidth());
|
||||
int h = luaL_optint(L, 5, i->getHeight());
|
||||
|
||||
luax_catchexcept(L, [&](){ i->refresh(xoffset, yoffset, w, h); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user