From 7e753a0acbf2c1cc87962242b64b8e6c22f3aefc Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Thu, 21 Mar 2013 11:27:40 -0300 Subject: [PATCH] Renamed love.graphics.setDefaultImageFilter to love.graphics.setDefaultFilter --- src/modules/graphics/opengl/Graphics.cpp | 4 +- src/modules/graphics/opengl/Graphics.h | 16 ++--- src/modules/graphics/opengl/wrap_Graphics.cpp | 62 +++++++++---------- src/modules/graphics/opengl/wrap_Graphics.h | 4 +- 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index 0447379c5..f0b4e7b94 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -629,12 +629,12 @@ Graphics::BlendMode Graphics::getBlendMode() const throw Exception("Unknown blend mode"); } -void Graphics::setDefaultImageFilter(const Image::Filter &f) +void Graphics::setDefaultFilter(const Image::Filter &f) { Image::setDefaultFilter(f); } -const Image::Filter &Graphics::getDefaultImageFilter() const +const Image::Filter &Graphics::getDefaultFilter() const { return Image::getDefaultFilter(); } diff --git a/src/modules/graphics/opengl/Graphics.h b/src/modules/graphics/opengl/Graphics.h index eb8cfbc83..4d34db1d1 100644 --- a/src/modules/graphics/opengl/Graphics.h +++ b/src/modules/graphics/opengl/Graphics.h @@ -304,20 +304,20 @@ public: **/ void setBlendMode(BlendMode mode); - /** - * Sets the current image filter. - **/ - void setDefaultImageFilter(const Image::Filter &f); - /** * Gets the current blend mode. **/ BlendMode getBlendMode() const; /** - * Gets the current image filter. + * Sets the default filter for images, canvases, and fonts. **/ - const Image::Filter &getDefaultImageFilter() const; + void setDefaultFilter(const Image::Filter &f); + + /** + * Gets the default filter for images, canvases, and fonts. + **/ + const Image::Filter &getDefaultFilter() const; /** * Default texture anisotropic filtering level. @@ -326,7 +326,7 @@ public: float getDefaultAnisotropy() const; /** - * Default Image mipmap filtermode and sharpness values. + * Default Image mipmap filter mode and sharpness values. **/ void setDefaultMipmapFilter(Image::FilterMode filter, float sharpness); void getDefaultMipmapFilter(Image::FilterMode *filter, float *sharpness) const; diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index e3d47e5d5..e12141c99 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -361,7 +361,7 @@ int w_newFont(lua_State *L) try { // Create the font. - font = instance->newFont(rasterizer, instance->getDefaultImageFilter()); + font = instance->newFont(rasterizer, instance->getDefaultFilter()); } catch (love::Exception &e) { @@ -426,7 +426,7 @@ int w_newImageFont(lua_State *L) } if (!setFilter) - img_filter = instance->getDefaultImageFilter(); + img_filter = instance->getDefaultFilter(); // Create the font. Font *font = instance->newFont(rasterizer, img_filter); @@ -719,31 +719,6 @@ int w_setBlendMode(lua_State *L) return 0; } -int w_setDefaultImageFilter(lua_State *L) -{ - Image::FilterMode min; - Image::FilterMode mag; - - const char *minstr = luaL_checkstring(L, 1); - const char *magstr = luaL_optstring(L, 2, 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; - - instance->setDefaultImageFilter(f); - - float anisotropy = (float) luaL_optnumber(L, 3, 1.0); - instance->setDefaultAnisotropy(anisotropy); - - return 0; -} - int w_getBlendMode(lua_State *L) { try @@ -761,9 +736,34 @@ int w_getBlendMode(lua_State *L) } } -int w_getDefaultImageFilter(lua_State *L) +int w_setDefaultFilter(lua_State *L) { - const Image::Filter &f = instance->getDefaultImageFilter(); + Image::FilterMode min; + Image::FilterMode mag; + + const char *minstr = luaL_checkstring(L, 1); + const char *magstr = luaL_optstring(L, 2, 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; + + instance->setDefaultFilter(f); + + float anisotropy = (float) luaL_optnumber(L, 3, 1.0); + instance->setDefaultAnisotropy(anisotropy); + + return 0; +} + +int w_getDefaultFilter(lua_State *L) +{ + const Image::Filter &f = instance->getDefaultFilter(); const char *minstr; const char *magstr; if (!Image::getConstant(f.min, minstr)) @@ -1409,9 +1409,9 @@ static const luaL_Reg functions[] = { "getFont", w_getFont }, { "setBlendMode", w_setBlendMode }, - { "setDefaultImageFilter", w_setDefaultImageFilter }, { "getBlendMode", w_getBlendMode }, - { "getDefaultImageFilter", w_getDefaultImageFilter }, + { "setDefaultFilter", w_setDefaultFilter }, + { "getDefaultFilter", w_getDefaultFilter }, { "setDefaultMipmapFilter", w_setDefaultMipmapFilter }, { "getDefaultMipmapFilter", w_getDefaultMipmapFilter }, { "setLineWidth", w_setLineWidth }, diff --git a/src/modules/graphics/opengl/wrap_Graphics.h b/src/modules/graphics/opengl/wrap_Graphics.h index 70a7cfa17..1d4dea8a3 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.h +++ b/src/modules/graphics/opengl/wrap_Graphics.h @@ -72,9 +72,9 @@ int w_getBackgroundColor(lua_State *L); int w_setFont(lua_State *L); int w_getFont(lua_State *L); int w_setBlendMode(lua_State *L); -int w_setDefaultImageFilter(lua_State *L); int w_getBlendMode(lua_State *L); -int w_getDefaultImageFilter(lua_State *L); +int w_setDefaultFilter(lua_State *L); +int w_getDefaultFilter(lua_State *L); int w_setDefaultMipmapFilter(lua_State *L); int w_getDefaultMipmapFilter(lua_State *L); int w_setLineWidth(lua_State *L);