From c68a7828209e02f517170ca0eff48658f3b6229d Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Sun, 12 Aug 2007 23:21:45 +0000 Subject: [PATCH] Fix really stupid parameter-related bug in box blur, and update documentation. Originally committed to SVN as r1480. --- OverLua/docs/overlua.txt | 6 ++---- OverLua/raster_ops.cpp | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/OverLua/docs/overlua.txt b/OverLua/docs/overlua.txt index b1cd017ee..3b4a00ed4 100644 --- a/OverLua/docs/overlua.txt +++ b/OverLua/docs/overlua.txt @@ -143,11 +143,9 @@ raster.gaussian_blur(surface, sigma) Applies a strength sigma gaussian blur on the surface. -raster.box3(surface, repetitions) -raster.box5(sutface, repetitions) -raster.box15(surface, repetitions) +raster.box(surface, size, repetitions) -Applies a box filter (blur) of various sizes to the surface as many times as +Applies a box filter (blur) of variable size to the surface as many times as specified. Please note that no specific optimisation is done for applying box filters over more general filters and using box blur over gaussian blur is probably no faster and might even be slower. diff --git a/OverLua/raster_ops.cpp b/OverLua/raster_ops.cpp index 7e2db4d28..56b0365bb 100644 --- a/OverLua/raster_ops.cpp +++ b/OverLua/raster_ops.cpp @@ -329,9 +329,9 @@ static int gaussian_blur(lua_State *L) static int box_blur(lua_State *L) { LuaCairoSurface *surfobj = LuaCairoSurface::GetObjPointer(L, 1); - int width = luaL_checkint(L, 1); + int width = luaL_checkint(L, 2); if (width <= 0) { luaL_error(L, "Width of box kernel for raster.box must be larger than zero, specified to %d.", width); return 0; } - int applications = luaL_optint(L, 1, 1); + int applications = luaL_optint(L, 3, 1); int *kernel = new int[width]; for (int i = 0; i < width; i++) kernel[i] = 1;