mirror of
https://github.com/love2d/love.git
synced 2026-08-18 11:44:15 +02:00
Correctly read filter modes in newImageFont when the implicit newRasterizer is used (issue #437)
This commit is contained in:
@@ -303,6 +303,9 @@ int w_newImageFont(lua_State *L)
|
|||||||
Image::Filter img_filter;
|
Image::Filter img_filter;
|
||||||
bool setFilter = false;
|
bool setFilter = false;
|
||||||
|
|
||||||
|
// For the filter modes..
|
||||||
|
int startIndex = 2;
|
||||||
|
|
||||||
// Convert to ImageData if necessary.
|
// Convert to ImageData if necessary.
|
||||||
if (lua_isstring(L, 1) || luax_istype(L, 1, FILESYSTEM_FILE_T) || (luax_istype(L, 1, DATA_T) && !luax_istype(L, 1, IMAGE_IMAGE_DATA_T)))
|
if (lua_isstring(L, 1) || luax_istype(L, 1, FILESYSTEM_FILE_T) || (luax_istype(L, 1, DATA_T) && !luax_istype(L, 1, IMAGE_IMAGE_DATA_T)))
|
||||||
luax_convobj(L, 1, "image", "newImageData");
|
luax_convobj(L, 1, "image", "newImageData");
|
||||||
@@ -321,16 +324,17 @@ int w_newImageFont(lua_State *L)
|
|||||||
{
|
{
|
||||||
int idxs[] = {1, 2};
|
int idxs[] = {1, 2};
|
||||||
luax_convobj(L, idxs, 2, "font", "newRasterizer");
|
luax_convobj(L, idxs, 2, "font", "newRasterizer");
|
||||||
|
startIndex = 3; // There's a glyphs args in there, move up
|
||||||
}
|
}
|
||||||
|
|
||||||
love::font::Rasterizer *rasterizer = luax_checktype<love::font::Rasterizer>(L, 1, "Rasterizer", FONT_RASTERIZER_T);
|
love::font::Rasterizer *rasterizer = luax_checktype<love::font::Rasterizer>(L, 1, "Rasterizer", FONT_RASTERIZER_T);
|
||||||
|
|
||||||
if (lua_isstring(L, 2) && lua_isstring(L, 3))
|
if (lua_isstring(L, startIndex) && lua_isstring(L, startIndex+1))
|
||||||
{
|
{
|
||||||
Image::FilterMode min;
|
Image::FilterMode min;
|
||||||
Image::FilterMode mag;
|
Image::FilterMode mag;
|
||||||
const char *minstr = luaL_checkstring(L, 2);
|
const char *minstr = luaL_checkstring(L, startIndex);
|
||||||
const char *magstr = luaL_checkstring(L, 3);
|
const char *magstr = luaL_checkstring(L, startIndex+1);
|
||||||
if (!Image::getConstant(minstr, min))
|
if (!Image::getConstant(minstr, min))
|
||||||
return luaL_error(L, "Invalid filter mode: %s", minstr);
|
return luaL_error(L, "Invalid filter mode: %s", minstr);
|
||||||
if (!Image::getConstant(magstr, mag))
|
if (!Image::getConstant(magstr, mag))
|
||||||
|
|||||||
Reference in New Issue
Block a user