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:
Alex Szpakowski
2014-08-26 09:40:24 -03:00
parent 760304e023
commit 8a7481eaa3
3 changed files with 90 additions and 67 deletions
+7 -1
View File
@@ -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;
}