From b1bbc998960fff2169dc5a992c47d08723472f9b Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 14 Oct 2018 22:52:40 +0800 Subject: =?UTF-8?q?*=E7=9B=B4=E6=8E=A5=E6=B8=B2=E6=9F=93=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lua/modules/graphics/page.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/lua/modules/graphics/page.cpp') diff --git a/src/lua/modules/graphics/page.cpp b/src/lua/modules/graphics/page.cpp index fd96448..c0a3184 100644 --- a/src/lua/modules/graphics/page.cpp +++ b/src/lua/modules/graphics/page.cpp @@ -3,6 +3,8 @@ #include "lua/common/common.h" #include "libjin/jin.h" +#include + namespace jin { namespace lua @@ -21,29 +23,35 @@ namespace lua static int l_gc(lua_State* L) { Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_PAGE); - proxy->release(); + { + /* release font */ + Ref* page = &proxy->getRef(); + RefBase* font = (RefBase*)page->getUserdata(); + font->release(); + } + proxy->release(); return 0; } static int l_getSize(lua_State* L) { Page* page = getPage(L); - luax_pushinteger(L, page->width); - luax_pushinteger(L, page->height); + luax_pushinteger(L, page->size.w); + luax_pushinteger(L, page->size.h); return 2; } static int l_getWidth(lua_State* L) { Page* page = getPage(L); - luax_pushinteger(L, page->width); + luax_pushinteger(L, page->size.w); return 1; } static int l_getHeight(lua_State* L) { Page* page = getPage(L); - luax_pushinteger(L, page->height); + luax_pushinteger(L, page->size.h); return 1; } -- cgit v1.1-26-g67d0