From 7c2f33bdf37de7acf9b0728a115377081344db1c Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 11 Nov 2018 20:18:26 +0800 Subject: =?UTF-8?q?*=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lua/modules/graphics/je_lua_bitmap.cpp | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/lua/modules/graphics/je_lua_bitmap.cpp') diff --git a/src/lua/modules/graphics/je_lua_bitmap.cpp b/src/lua/modules/graphics/je_lua_bitmap.cpp index 8d4897b..2a35ed5 100644 --- a/src/lua/modules/graphics/je_lua_bitmap.cpp +++ b/src/lua/modules/graphics/je_lua_bitmap.cpp @@ -10,9 +10,9 @@ namespace JinEngine namespace Lua { - typedef Shared& BitmapRef; + typedef Shared& SharedBitmap; - LUA_IMPLEMENT inline BitmapRef checkBitmap(lua_State* L) + LUA_IMPLEMENT inline SharedBitmap checkBitmap(lua_State* L) { Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_BITMAP); return proxy->getShared(); @@ -20,32 +20,32 @@ namespace JinEngine LUA_IMPLEMENT int l_gc(lua_State* L) { - BitmapRef ref = checkBitmap(L); - ref.release(); + SharedBitmap shared = checkBitmap(L); + shared.release(); return 0; } LUA_IMPLEMENT int l_getWidth(lua_State* L) { - BitmapRef ref = checkBitmap(L); - int w = ref->getWidth(); + SharedBitmap shared = checkBitmap(L); + int w = shared->getWidth(); luax_pushinteger(L, w); return 1; } LUA_IMPLEMENT int l_getHeight(lua_State* L) { - BitmapRef ref = checkBitmap(L); - int h = ref->getHeight(); + SharedBitmap shared = checkBitmap(L); + int h = shared->getHeight(); luax_pushinteger(L, h); return 1; } LUA_IMPLEMENT int l_getSize(lua_State* L) { - BitmapRef ref = checkBitmap(L); - int w = ref->getWidth(); - int h = ref->getHeight(); + SharedBitmap shared = checkBitmap(L); + int w = shared->getWidth(); + int h = shared->getHeight(); luax_pushinteger(L, w); luax_pushinteger(L, h); return 2; @@ -53,10 +53,10 @@ namespace JinEngine LUA_IMPLEMENT int l_getPixel(lua_State* L) { - BitmapRef ref = checkBitmap(L); + SharedBitmap shared = checkBitmap(L); int x = luax_checkinteger(L, 2); int y = luax_checkinteger(L, 3); - Color col = ref->getPixel(x, y); + Color col = shared->getPixel(x, y); luax_pushinteger(L, col.r); luax_pushinteger(L, col.g); luax_pushinteger(L, col.b); @@ -66,7 +66,7 @@ namespace JinEngine LUA_IMPLEMENT int l_setPixel(lua_State* L) { - BitmapRef ref = checkBitmap(L); + SharedBitmap shared = checkBitmap(L); int x = luax_checkinteger(L, 2); int y = luax_checkinteger(L, 3); if (!luax_istable(L, 4)) @@ -78,16 +78,16 @@ namespace JinEngine unsigned int g = luax_rawgetnumber(L, 4, 2); unsigned int b = luax_rawgetnumber(L, 4, 3); unsigned int a = luax_rawgetnumber(L, 4, 4); - ref->setPixel(Color(r, g, b, a), x, y); + shared->setPixel(Color(r, g, b, a), x, y); return 0; } LUA_IMPLEMENT int l_clone(lua_State* L) { - BitmapRef ref = checkBitmap(L); - Bitmap* bitmap = ref.getObject(); + SharedBitmap shared = checkBitmap(L); + Bitmap* bitmap = shared.getObject(); Bitmap* b = Bitmap::clone(bitmap); - Proxy* proxy = (Proxy*)luax_newinstance(L, JIN_GRAPHICS_BITMAP, sizeof(Proxy)); + Proxy* proxy = luax_newinstance(L, JIN_GRAPHICS_BITMAP); proxy->bind(new Shared(b, JIN_GRAPHICS_BITMAP)); return 1; } -- cgit v1.1-26-g67d0