Applied patch from issue #542 (texture filtering inconsistencies) in main LÖVE repository

This commit is contained in:
Alexander Szpakowski
2013-01-01 21:29:38 -04:00
parent a8dc813258
commit 1678252b7a
15 changed files with 315 additions and 204 deletions
+41
View File
@@ -90,6 +90,45 @@ int w_Font_getLineHeight(lua_State *L)
return 1;
}
int w_Font_setFilter(lua_State *L)
{
Font *t = luax_checkfont(L, 1);
Image::FilterMode min;
Image::FilterMode mag;
const char *minstr = luaL_checkstring(L, 2);
const char *magstr = luaL_optstring(L, 3, minstr);
if (!Image::getConstant(minstr, min))
return luaL_error(L, "Invalid filter mode: %s", minstr);
if (!Image::getConstant(magstr, mag))
return luaL_error(L, "Invalid filter mode: %s", magstr);
Image::Filter f;
f.min = min;
f.mag = mag;
t->setFilter(f);
return 0;
}
int w_Font_getFilter(lua_State *L)
{
Font *t = luax_checkfont(L, 1);
Image::Filter f = t->getFilter();
Image::FilterMode min = f.min;
Image::FilterMode mag = f.mag;
const char *minstr;
const char *magstr;
Image::getConstant(min, minstr);
Image::getConstant(mag, magstr);
lua_pushstring(L, minstr);
lua_pushstring(L, magstr);
return 2;
}
static const luaL_Reg functions[] =
{
{ "getHeight", w_Font_getHeight },
@@ -97,6 +136,8 @@ static const luaL_Reg functions[] =
{ "getWrap", w_Font_getWrap },
{ "setLineHeight", w_Font_setLineHeight },
{ "getLineHeight", w_Font_getLineHeight },
{ "setFilter", w_Font_setFilter },
{ "getFilter", w_Font_getFilter },
{ 0, 0 }
};