summaryrefslogtreecommitdiff
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
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
-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
54 int width; 54 int width;
55 int height; 55 int height;
56 fb_data *data; 56 fb_data *data;
57 fb_data dummy[1][1];
57}; 58};
58 59
59static void rli_wrap(lua_State *L, fb_data *src, int width, int height) 60static void rli_wrap(lua_State *L, fb_data *src, int width, int height)
@@ -80,6 +81,7 @@ static int rli_new(lua_State *L)
80 81
81 a->width = width; 82 a->width = width;
82 a->height = height; 83 a->height = height;
84 a->data = &a->dummy[0][0];
83 return 1; 85 return 1;
84} 86}
85 87
@@ -691,6 +693,27 @@ RB_WRAP(font_getstringsize)
691 return 3; 693 return 3;
692} 694}
693 695
696#ifdef HAVE_LCD_COLOR
697RB_WRAP(lcd_rgbpack)
698{
699 int r = luaL_checkint(L, 1);
700 int g = luaL_checkint(L, 2);
701 int b = luaL_checkint(L, 3);
702 int result = LCD_RGBPACK(r, g, b);
703 lua_pushinteger(L, result);
704 return 1;
705}
706
707RB_WRAP(lcd_rgbunpack)
708{
709 int rgb = luaL_checkint(L, 1);
710 lua_pushinteger(L, RGB_UNPACK_RED(rgb));
711 lua_pushinteger(L, RGB_UNPACK_GREEN(rgb));
712 lua_pushinteger(L, RGB_UNPACK_BLUE(rgb));
713 return 3;
714}
715#endif
716
694#define R(NAME) {#NAME, rock_##NAME} 717#define R(NAME) {#NAME, rock_##NAME}
695static const luaL_Reg rocklib[] = 718static const luaL_Reg rocklib[] =
696{ 719{
@@ -728,6 +751,10 @@ static const luaL_Reg rocklib[] =
728 R(lcd_bitmap_transparent), 751 R(lcd_bitmap_transparent),
729#endif 752#endif
730#endif 753#endif
754#ifdef HAVE_LCD_COLOR
755 R(lcd_rgbpack),
756 R(lcd_rgbunpack),
757#endif
731 758
732 /* File handling */ 759 /* File handling */
733 R(open), 760 R(open),