mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
Rocklua -- Clean-up source
Change-Id: I11dad15320f209655fd72c2365fe29afd65057d3
This commit is contained in:
parent
07a0f206fe
commit
0565f67118
1 changed files with 19 additions and 19 deletions
|
@ -61,11 +61,11 @@ struct rocklua_image
|
||||||
int height;
|
int height;
|
||||||
fb_data *data;
|
fb_data *data;
|
||||||
fb_data dummy[1][1];
|
fb_data dummy[1][1];
|
||||||
};
|
} rocklua_image;
|
||||||
|
|
||||||
static void rli_wrap(lua_State *L, fb_data *src, int width, int height)
|
static void rli_wrap(lua_State *L, fb_data *src, int width, int height)
|
||||||
{
|
{
|
||||||
struct rocklua_image *a = (struct rocklua_image *)lua_newuserdata(L, sizeof(struct rocklua_image));
|
rocklua_image *a = (rocklua_image *)lua_newuserdata(L, sizeof(rocklua_image));
|
||||||
|
|
||||||
luaL_getmetatable(L, ROCKLUA_IMAGE);
|
luaL_getmetatable(L, ROCKLUA_IMAGE);
|
||||||
lua_setmetatable(L, -2);
|
lua_setmetatable(L, -2);
|
||||||
|
@ -77,8 +77,8 @@ static void rli_wrap(lua_State *L, fb_data *src, int width, int height)
|
||||||
|
|
||||||
static fb_data* rli_alloc(lua_State *L, int width, int height)
|
static fb_data* rli_alloc(lua_State *L, int width, int height)
|
||||||
{
|
{
|
||||||
size_t nbytes = sizeof(struct rocklua_image) + ((width*height) - 1) * sizeof(fb_data);
|
size_t nbytes = sizeof(rocklua_image) + ((width*height) - 1) * sizeof(fb_data);
|
||||||
struct rocklua_image *a = (struct rocklua_image *)lua_newuserdata(L, nbytes);
|
rocklua_image *a = (rocklua_image *)lua_newuserdata(L, nbytes);
|
||||||
|
|
||||||
luaL_getmetatable(L, ROCKLUA_IMAGE);
|
luaL_getmetatable(L, ROCKLUA_IMAGE);
|
||||||
lua_setmetatable(L, -2);
|
lua_setmetatable(L, -2);
|
||||||
|
@ -100,30 +100,30 @@ static int rli_new(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct rocklua_image* rli_checktype(lua_State *L, int arg)
|
static rocklua_image* rli_checktype(lua_State *L, int arg)
|
||||||
{
|
{
|
||||||
void *ud = luaL_checkudata(L, arg, ROCKLUA_IMAGE);
|
void *ud = luaL_checkudata(L, arg, ROCKLUA_IMAGE);
|
||||||
luaL_argcheck(L, ud != NULL, arg, "'" ROCKLUA_IMAGE "' expected");
|
luaL_argcheck(L, ud != NULL, arg, "'" ROCKLUA_IMAGE "' expected");
|
||||||
return (struct rocklua_image*) ud;
|
return (rocklua_image*) ud;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rli_width(lua_State *L)
|
static int rli_width(lua_State *L)
|
||||||
{
|
{
|
||||||
struct rocklua_image *a = rli_checktype(L, 1);
|
rocklua_image *a = rli_checktype(L, 1);
|
||||||
lua_pushnumber(L, a->width);
|
lua_pushnumber(L, a->width);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rli_height(lua_State *L)
|
static int rli_height(lua_State *L)
|
||||||
{
|
{
|
||||||
struct rocklua_image *a = rli_checktype(L, 1);
|
rocklua_image *a = rli_checktype(L, 1);
|
||||||
lua_pushnumber(L, a->height);
|
lua_pushnumber(L, a->height);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static fb_data* rli_element(lua_State *L)
|
static fb_data* rli_element(lua_State *L)
|
||||||
{
|
{
|
||||||
struct rocklua_image *a = rli_checktype(L, 1);
|
rocklua_image *a = rli_checktype(L, 1);
|
||||||
int x = luaL_checkint(L, 2);
|
int x = luaL_checkint(L, 2);
|
||||||
int y = luaL_checkint(L, 3);
|
int y = luaL_checkint(L, 3);
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ static int rli_get(lua_State *L)
|
||||||
|
|
||||||
static int rli_tostring(lua_State *L)
|
static int rli_tostring(lua_State *L)
|
||||||
{
|
{
|
||||||
struct rocklua_image *a = rli_checktype(L, 1);
|
rocklua_image *a = rli_checktype(L, 1);
|
||||||
lua_pushfstring(L, ROCKLUA_IMAGE ": %dx%d", a->width, a->height);
|
lua_pushfstring(L, ROCKLUA_IMAGE ": %dx%d", a->width, a->height);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -269,7 +269,7 @@ RB_WRAP(lcd_framebuffer)
|
||||||
|
|
||||||
RB_WRAP(lcd_mono_bitmap_part)
|
RB_WRAP(lcd_mono_bitmap_part)
|
||||||
{
|
{
|
||||||
struct rocklua_image *src = rli_checktype(L, 1);
|
rocklua_image *src = rli_checktype(L, 1);
|
||||||
int src_x = luaL_checkint(L, 2);
|
int src_x = luaL_checkint(L, 2);
|
||||||
int src_y = luaL_checkint(L, 3);
|
int src_y = luaL_checkint(L, 3);
|
||||||
int stride = luaL_checkint(L, 4);
|
int stride = luaL_checkint(L, 4);
|
||||||
|
@ -285,7 +285,7 @@ RB_WRAP(lcd_mono_bitmap_part)
|
||||||
|
|
||||||
RB_WRAP(lcd_mono_bitmap)
|
RB_WRAP(lcd_mono_bitmap)
|
||||||
{
|
{
|
||||||
struct rocklua_image *src = rli_checktype(L, 1);
|
rocklua_image *src = rli_checktype(L, 1);
|
||||||
int x = luaL_checkint(L, 2);
|
int x = luaL_checkint(L, 2);
|
||||||
int y = luaL_checkint(L, 3);
|
int y = luaL_checkint(L, 3);
|
||||||
int width = luaL_checkint(L, 4);
|
int width = luaL_checkint(L, 4);
|
||||||
|
@ -299,7 +299,7 @@ RB_WRAP(lcd_mono_bitmap)
|
||||||
#if LCD_DEPTH > 1
|
#if LCD_DEPTH > 1
|
||||||
RB_WRAP(lcd_bitmap_part)
|
RB_WRAP(lcd_bitmap_part)
|
||||||
{
|
{
|
||||||
struct rocklua_image *src = rli_checktype(L, 1);
|
rocklua_image *src = rli_checktype(L, 1);
|
||||||
int src_x = luaL_checkint(L, 2);
|
int src_x = luaL_checkint(L, 2);
|
||||||
int src_y = luaL_checkint(L, 3);
|
int src_y = luaL_checkint(L, 3);
|
||||||
int stride = luaL_checkint(L, 4);
|
int stride = luaL_checkint(L, 4);
|
||||||
|
@ -315,7 +315,7 @@ RB_WRAP(lcd_bitmap_part)
|
||||||
|
|
||||||
RB_WRAP(lcd_bitmap)
|
RB_WRAP(lcd_bitmap)
|
||||||
{
|
{
|
||||||
struct rocklua_image *src = rli_checktype(L, 1);
|
rocklua_image *src = rli_checktype(L, 1);
|
||||||
int x = luaL_checkint(L, 2);
|
int x = luaL_checkint(L, 2);
|
||||||
int y = luaL_checkint(L, 3);
|
int y = luaL_checkint(L, 3);
|
||||||
int width = luaL_checkint(L, 4);
|
int width = luaL_checkint(L, 4);
|
||||||
|
@ -341,7 +341,7 @@ RB_WRAP(lcd_get_backdrop)
|
||||||
#if LCD_DEPTH == 16
|
#if LCD_DEPTH == 16
|
||||||
RB_WRAP(lcd_bitmap_transparent_part)
|
RB_WRAP(lcd_bitmap_transparent_part)
|
||||||
{
|
{
|
||||||
struct rocklua_image *src = rli_checktype(L, 1);
|
rocklua_image *src = rli_checktype(L, 1);
|
||||||
int src_x = luaL_checkint(L, 2);
|
int src_x = luaL_checkint(L, 2);
|
||||||
int src_y = luaL_checkint(L, 3);
|
int src_y = luaL_checkint(L, 3);
|
||||||
int stride = luaL_checkint(L, 4);
|
int stride = luaL_checkint(L, 4);
|
||||||
|
@ -357,7 +357,7 @@ RB_WRAP(lcd_bitmap_transparent_part)
|
||||||
|
|
||||||
RB_WRAP(lcd_bitmap_transparent)
|
RB_WRAP(lcd_bitmap_transparent)
|
||||||
{
|
{
|
||||||
struct rocklua_image *src = rli_checktype(L, 1);
|
rocklua_image *src = rli_checktype(L, 1);
|
||||||
int x = luaL_checkint(L, 2);
|
int x = luaL_checkint(L, 2);
|
||||||
int y = luaL_checkint(L, 3);
|
int y = luaL_checkint(L, 3);
|
||||||
int width = luaL_checkint(L, 4);
|
int width = luaL_checkint(L, 4);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue