diff options
author | William Wilgus <me.theuser@yahoo.com> | 2018-10-22 14:00:58 -0400 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2018-10-22 14:00:58 -0400 |
commit | 948984309a3c1dd6b92f018926e9831083c803e3 (patch) | |
tree | a79bda99ff3d905828f4ea407f912cc22c1c5a4f /apps/plugins/lua/rocklib_img.c | |
parent | 7a132a257a47be37daa2da97706745ca9182d14a (diff) | |
download | rockbox-948984309a3c1dd6b92f018926e9831083c803e3.tar.gz rockbox-948984309a3c1dd6b92f018926e9831083c803e3.zip |
lua move rocklib_img to its own separate loadable module
allows rocklib_img to be excluded if needed
stops rocklib_aux from generating redundant prototypes for
lcd_mono_bitmap[_part]
Change-Id: Ie208ad71ab5f9a7deb026dc01a5b0a0631a0d29c
Diffstat (limited to 'apps/plugins/lua/rocklib_img.c')
-rw-r--r-- | apps/plugins/lua/rocklib_img.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/apps/plugins/lua/rocklib_img.c b/apps/plugins/lua/rocklib_img.c index 39f6a51521..909f1b61b9 100644 --- a/apps/plugins/lua/rocklib_img.c +++ b/apps/plugins/lua/rocklib_img.c | |||
@@ -1188,7 +1188,7 @@ RLI_LUA rli_clear(lua_State *L) | |||
1188 | #endif /* RLI_EXTENDED */ | 1188 | #endif /* RLI_EXTENDED */ |
1189 | 1189 | ||
1190 | /* Rli Image methods exported to lua */ | 1190 | /* Rli Image methods exported to lua */ |
1191 | const struct luaL_reg rli_lib [] = | 1191 | static const struct luaL_reg rli_lib [] = |
1192 | { | 1192 | { |
1193 | {"__tostring", rli_tostring}, | 1193 | {"__tostring", rli_tostring}, |
1194 | {"_data", rli_raw}, | 1194 | {"_data", rli_raw}, |
@@ -1212,22 +1212,6 @@ const struct luaL_reg rli_lib [] = | |||
1212 | {NULL, NULL} | 1212 | {NULL, NULL} |
1213 | }; | 1213 | }; |
1214 | 1214 | ||
1215 | LUALIB_API int rli_init(lua_State *L) | ||
1216 | { | ||
1217 | /* some devices need x | y coords shifted to match native format */ | ||
1218 | /* conversion between packed native formats and individual pixel addressing */ | ||
1219 | init_pixelmask(&x_shift, &y_shift, &xy_mask, &pixelmask); | ||
1220 | |||
1221 | luaL_newmetatable(L, ROCKLUA_IMAGE); | ||
1222 | |||
1223 | lua_pushvalue(L, -1); /* pushes the metatable */ | ||
1224 | lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ | ||
1225 | |||
1226 | luaL_register(L, NULL, rli_lib); | ||
1227 | |||
1228 | return 1; | ||
1229 | } | ||
1230 | |||
1231 | /* | 1215 | /* |
1232 | * ----------------------------- | 1216 | * ----------------------------- |
1233 | * | 1217 | * |
@@ -1402,7 +1386,7 @@ RB_WRAP(read_bmp_file) | |||
1402 | } | 1386 | } |
1403 | 1387 | ||
1404 | #define R(NAME) {#NAME, rock_##NAME} | 1388 | #define R(NAME) {#NAME, rock_##NAME} |
1405 | const luaL_Reg rocklib_img[] = | 1389 | static const luaL_Reg rocklib_img[] = |
1406 | { | 1390 | { |
1407 | /* Graphics */ | 1391 | /* Graphics */ |
1408 | #ifdef HAVE_LCD_BITMAP | 1392 | #ifdef HAVE_LCD_BITMAP |
@@ -1430,3 +1414,19 @@ const luaL_Reg rocklib_img[] = | |||
1430 | }; | 1414 | }; |
1431 | #undef R | 1415 | #undef R |
1432 | 1416 | ||
1417 | LUALIB_API int luaopen_rock_img(lua_State *L) | ||
1418 | { | ||
1419 | /* some devices need x | y coords shifted to match native format */ | ||
1420 | /* conversion between packed native formats and individual pixel addressing */ | ||
1421 | init_pixelmask(&x_shift, &y_shift, &xy_mask, &pixelmask); | ||
1422 | |||
1423 | luaL_newmetatable(L, ROCKLUA_IMAGE); | ||
1424 | |||
1425 | lua_pushvalue(L, -1); /* pushes the metatable */ | ||
1426 | lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ | ||
1427 | |||
1428 | luaL_register(L, LUA_ROCKLIBNAME, rocklib_img); | ||
1429 | luaL_register(L, NULL, rli_lib); | ||
1430 | |||
1431 | return 1; | ||
1432 | } | ||