mirror of
https://github.com/love2d/love.git
synced 2026-08-19 20:19:42 +02:00
Fixed two cases of inefficient usage of the lua api
This commit is contained in:
@@ -295,12 +295,8 @@ namespace opengl
|
|||||||
int w_newFramebuffer(lua_State * L)
|
int w_newFramebuffer(lua_State * L)
|
||||||
{
|
{
|
||||||
// check if width and height are given. else default to screen dimensions.
|
// check if width and height are given. else default to screen dimensions.
|
||||||
int width = instance->getWidth();
|
int width = luaL_optint(L, 1, instance->getWidth());
|
||||||
int height = instance->getHeight();
|
int height = luaL_optint(L, 2, instance->getHeight());
|
||||||
if (lua_gettop(L) >= 2) {
|
|
||||||
width = luaL_optint(L, 1, instance->getWidth());
|
|
||||||
height = luaL_optint(L, 2, instance->getHeight());
|
|
||||||
}
|
|
||||||
glGetError(); // clear opengl error flag
|
glGetError(); // clear opengl error flag
|
||||||
Framebuffer * framebuffer = instance->newFramebuffer(width, height);
|
Framebuffer * framebuffer = instance->newFramebuffer(width, height);
|
||||||
|
|
||||||
@@ -614,7 +610,7 @@ namespace opengl
|
|||||||
int w_setRenderTarget(lua_State * L)
|
int w_setRenderTarget(lua_State * L)
|
||||||
{
|
{
|
||||||
// called with nil or none -> reset to default buffer
|
// called with nil or none -> reset to default buffer
|
||||||
if (lua_isnone(L,1) || lua_isnil(L, 1)) {
|
if (lua_isnoneornil(L,1)) {
|
||||||
Framebuffer::bindDefaultBuffer();
|
Framebuffer::bindDefaultBuffer();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user