summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-05-24 02:18:03 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2009-05-24 02:18:03 +0000
commit6f6cfed6cea3f73d0628b6981290c61e611d7ca5 (patch)
treef137380711c0c30c886cd1fcb39b5d5e3674501f /apps
parent86fe1e8b5cdfd536fb19018fc15d9088e13bf676 (diff)
downloadrockbox-6f6cfed6cea3f73d0628b6981290c61e611d7ca5.tar.gz
rockbox-6f6cfed6cea3f73d0628b6981290c61e611d7ca5.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/lua/rocklib.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index 7daed0c93d..749acc3831 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -54,6 +54,7 @@ struct rocklua_image
int width;
int height;
fb_data *data;
+ fb_data dummy[1][1];
};
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->height = height;
+ a->data = &a->dummy[0][0];
return 1;
}
@@ -691,6 +693,27 @@ RB_WRAP(font_getstringsize)
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}
static const luaL_Reg rocklib[] =
{
@@ -728,6 +751,10 @@ static const luaL_Reg rocklib[] =
R(lcd_bitmap_transparent),
#endif
#endif
+#ifdef HAVE_LCD_COLOR
+ R(lcd_rgbpack),
+ R(lcd_rgbunpack),
+#endif
/* File handling */
R(open),