Removed backup buffer & some LUA fixes
This commit is contained in:
committed by
Raphael Coeffic
parent
56bec5ca3a
commit
99270482dc
@@ -25,14 +25,6 @@
|
||||
uint8_t LCD_FIRST_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(pixel_t)] __SDRAM;
|
||||
uint8_t LCD_SECOND_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(pixel_t)] __SDRAM;
|
||||
|
||||
//TODO: this needs to go away...
|
||||
uint8_t LCD_BACKUP_FRAME_BUFFER[DISPLAY_BUFFER_SIZE * sizeof(pixel_t)] __SDRAM;
|
||||
|
||||
uint16_t* lcdGetBackupBuffer()
|
||||
{
|
||||
return (uint16_t*)LCD_BACKUP_FRAME_BUFFER;
|
||||
}
|
||||
|
||||
BitmapBuffer lcdBuffer1(BMP_RGB565, LCD_W, LCD_H, (uint16_t *)LCD_FIRST_FRAME_BUFFER);
|
||||
BitmapBuffer lcdBuffer2(BMP_RGB565, LCD_W, LCD_H, (uint16_t *)LCD_SECOND_FRAME_BUFFER);
|
||||
|
||||
@@ -64,6 +56,8 @@ void lcdSetFlushCb(void (*cb)(lv_disp_drv_t *, uint16_t*, const rect_t&))
|
||||
lcd_flush_cb = cb;
|
||||
}
|
||||
|
||||
static lv_disp_drv_t* refr_disp = nullptr;
|
||||
|
||||
static void flushLcd(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
|
||||
{
|
||||
lv_area_t refr_area;
|
||||
@@ -82,6 +76,7 @@ static void flushLcd(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_
|
||||
refr_area.y2 - refr_area.y1 + 1};
|
||||
|
||||
if (lcd_flush_cb) {
|
||||
refr_disp = disp_drv;
|
||||
lcd_flush_cb(disp_drv, (uint16_t*)color_p, copy_area);
|
||||
} else {
|
||||
lv_disp_flush_ready(disp_drv);
|
||||
@@ -148,8 +143,7 @@ void lcdRefresh()
|
||||
|
||||
void lcdFlushed()
|
||||
{
|
||||
lv_disp_t* disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_flush_ready(disp->driver);
|
||||
lv_disp_flush_ready(refr_disp);
|
||||
}
|
||||
|
||||
//TODO: move this somewhere else
|
||||
|
||||
@@ -55,12 +55,9 @@ StandaloneLuaWindow* StandaloneLuaWindow::_instance;
|
||||
bool StandaloneLuaWindow::fingerDown = false;
|
||||
#endif
|
||||
|
||||
// LUA lcd buffer
|
||||
uint16_t* lcdGetBackupBuffer();
|
||||
|
||||
StandaloneLuaWindow::StandaloneLuaWindow() :
|
||||
Window(nullptr, {0, 0, LCD_W, LCD_H}, OPAQUE),
|
||||
lcdBuffer(BMP_RGB565, LCD_W, LCD_H, lcdGetBackupBuffer()),
|
||||
lcdBuffer(BMP_RGB565, LCD_W, LCD_H),
|
||||
popup({50, 73, LCD_W - 100, LCD_H - 146})
|
||||
{
|
||||
}
|
||||
@@ -88,31 +85,27 @@ void StandaloneLuaWindow::attach(Window* newParent)
|
||||
|
||||
Layer::push(this);
|
||||
}
|
||||
|
||||
setFocus();
|
||||
}
|
||||
|
||||
void StandaloneLuaWindow::deleteLater(bool detach, bool /*trash*/)
|
||||
void StandaloneLuaWindow::deleteLater(bool detach, bool trash)
|
||||
{
|
||||
Layer::pop(this);
|
||||
if (_deleted)
|
||||
return;
|
||||
|
||||
// do not trash: we are a singleton
|
||||
if (static_cast<Window*>(focusWindow) == static_cast<Window*>(this)) {
|
||||
focusWindow = nullptr;
|
||||
}
|
||||
Layer::pop(this);
|
||||
|
||||
if (prevScreen) {
|
||||
lv_scr_load(prevScreen);
|
||||
prevScreen = nullptr;
|
||||
}
|
||||
|
||||
// detach from parent
|
||||
if (detach) {
|
||||
this->detach();
|
||||
}
|
||||
|
||||
if (closeHandler) {
|
||||
closeHandler();
|
||||
if (trash) {
|
||||
_instance = nullptr;
|
||||
}
|
||||
|
||||
Window::deleteLater(detach, trash);
|
||||
}
|
||||
|
||||
void StandaloneLuaWindow::paint(BitmapBuffer* dc)
|
||||
|
||||
@@ -229,7 +229,7 @@ static void drawString(lua_State *L, const char * s, LcdFlags flags)
|
||||
|
||||
// Draw color box
|
||||
int height = getFontHeight(flags & 0xFFFF) + 2 * INVERT_BOX_MARGIN;
|
||||
int width = getTextWidth(s, 255, flags);
|
||||
int width = getTextWidth(s, 0, flags);
|
||||
int ix = x - INVERT_BOX_MARGIN;
|
||||
if (flags & RIGHT)
|
||||
ix -= width;
|
||||
@@ -288,7 +288,7 @@ static int luaLcdSizeText(lua_State *L)
|
||||
{
|
||||
const char * s = luaL_checkstring(L, 1);
|
||||
LcdFlags flags = luaL_optunsigned(L, 2, 0);
|
||||
lua_pushinteger(L, getTextWidth(s, 255, flags));
|
||||
lua_pushinteger(L, getTextWidth(s, 0, flags));
|
||||
lua_pushinteger(L, getFontHeight(flags & 0xFFFF) + getTextVerticalOffset(flags & ~VCENTERED));
|
||||
return 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user