1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-15 04:15:26 +03:00

[Horus] Bitmaps dynamic load

This commit is contained in:
Bertrand Songis 2016-02-21 18:25:52 +01:00
parent 63713578fe
commit 358badfed9
12 changed files with 117 additions and 99 deletions

View file

@ -352,11 +352,20 @@ static int luaLcdDrawPixmap(lua_State *L)
int x = luaL_checkinteger(L, 1);
int y = luaL_checkinteger(L, 2);
const char * filename = luaL_checkstring(L, 3);
#if defined(PCBTARANIS)
uint8_t bitmap[BITMAP_BUFFER_SIZE(LCD_W/2, LCD_H)]; // width max is LCD_W/2 pixels for saving stack and avoid a malloc here
const pm_char * error = bmpLoad(bitmap, filename, LCD_W/2, LCD_H);
if (!error) {
if (bmpLoad(bitmap, filename, LCD_W/2, LCD_H)) {
lcdDrawBitmap(x, y, bitmap);
}
#else
uint8_t * bitmap = bmpLoad(filename);
if (bitmap) {
lcdDrawBitmap(x, y, bitmap);
free(bitmap);
}
#endif
return 0;
}
#endif