mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 10:37:38 -04:00
Lua: fix rocklua_image issue + add LCD_RGBPACK & LCD_RGBUNPACK wrappers
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21064 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
86fe1e8b5c
commit
6f6cfed6ce
1 changed files with 27 additions and 0 deletions
|
@ -54,6 +54,7 @@ struct rocklua_image
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
fb_data *data;
|
fb_data *data;
|
||||||
|
fb_data dummy[1][1];
|
||||||
};
|
};
|
||||||
|
|
||||||
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)
|
||||||
|
@ -80,6 +81,7 @@ static int rli_new(lua_State *L)
|
||||||
|
|
||||||
a->width = width;
|
a->width = width;
|
||||||
a->height = height;
|
a->height = height;
|
||||||
|
a->data = &a->dummy[0][0];
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -691,6 +693,27 @@ RB_WRAP(font_getstringsize)
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
RB_WRAP(lcd_rgbpack)
|
||||||
|
{
|
||||||
|
int r = luaL_checkint(L, 1);
|
||||||
|
int g = luaL_checkint(L, 2);
|
||||||
|
int b = luaL_checkint(L, 3);
|
||||||
|
int result = LCD_RGBPACK(r, g, b);
|
||||||
|
lua_pushinteger(L, result);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
RB_WRAP(lcd_rgbunpack)
|
||||||
|
{
|
||||||
|
int rgb = luaL_checkint(L, 1);
|
||||||
|
lua_pushinteger(L, RGB_UNPACK_RED(rgb));
|
||||||
|
lua_pushinteger(L, RGB_UNPACK_GREEN(rgb));
|
||||||
|
lua_pushinteger(L, RGB_UNPACK_BLUE(rgb));
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define R(NAME) {#NAME, rock_##NAME}
|
#define R(NAME) {#NAME, rock_##NAME}
|
||||||
static const luaL_Reg rocklib[] =
|
static const luaL_Reg rocklib[] =
|
||||||
{
|
{
|
||||||
|
@ -727,6 +750,10 @@ static const luaL_Reg rocklib[] =
|
||||||
R(lcd_bitmap_transparent_part),
|
R(lcd_bitmap_transparent_part),
|
||||||
R(lcd_bitmap_transparent),
|
R(lcd_bitmap_transparent),
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
R(lcd_rgbpack),
|
||||||
|
R(lcd_rgbunpack),
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* File handling */
|
/* File handling */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue