mirror of
https://gitlab.com/c3d/db48x.git
synced 2024-09-29 05:36:58 +02:00
Increment screen update to make it easier to detect changes
If multiple consumers need to check if the screen has changed, a simple flag does not do it. Instead, increment a counter that each client will be able to check indepdendently. This will be useful for an upcoming test framework Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This commit is contained in:
parent
d6fa249301
commit
c3b6cebb32
3 changed files with 16 additions and 9 deletions
18
sim/dmcp.cpp
18
sim/dmcp.cpp
|
@ -54,7 +54,7 @@ RECORDER(lcd_warning, 64, "Warnings from lcd/display functions");
|
|||
|
||||
#undef ppgm_fp
|
||||
|
||||
volatile int lcd_needsupdate = 1;
|
||||
volatile int lcd_needsupdate = 0;
|
||||
int lcd_buf_cleared = 0;
|
||||
uint8_t lcd_buffer[LCD_SCANLINE * LCD_H / 8];
|
||||
|
||||
|
@ -113,6 +113,12 @@ int key_empty()
|
|||
{
|
||||
return keyrd == keywr;
|
||||
}
|
||||
|
||||
int key_remaining()
|
||||
{
|
||||
return nkeys - (keywr - keyrd);
|
||||
}
|
||||
|
||||
int key_pop()
|
||||
{
|
||||
if (keyrd != keywr)
|
||||
|
@ -332,27 +338,27 @@ void lcd_print(disp_stat_t * ds, const char* fmt, ...)
|
|||
void lcd_forced_refresh()
|
||||
{
|
||||
record(lcd, "Forced refresh");
|
||||
lcd_needsupdate = 1;
|
||||
lcd_needsupdate++;
|
||||
}
|
||||
void lcd_refresh()
|
||||
{
|
||||
record(lcd, "Refresh");
|
||||
lcd_needsupdate = 1;
|
||||
lcd_needsupdate++;
|
||||
}
|
||||
void lcd_refresh_dma()
|
||||
{
|
||||
record(lcd, "Refresh DMA");
|
||||
lcd_needsupdate = 1;
|
||||
lcd_needsupdate++;
|
||||
}
|
||||
void lcd_refresh_wait()
|
||||
{
|
||||
record(lcd, "Refresh Wait");
|
||||
lcd_needsupdate = 1;
|
||||
lcd_needsupdate++;
|
||||
}
|
||||
void lcd_refresh_lines(int ln, int cnt)
|
||||
{
|
||||
record(lcd, "Refresh lines (%d-%d) count %d", ln, ln+cnt-1, cnt);
|
||||
lcd_needsupdate = ln >= 0 && cnt > 0;
|
||||
lcd_needsupdate += (ln >= 0 && cnt > 0);
|
||||
}
|
||||
void lcd_setLine(disp_stat_t * ds, int ln_nr)
|
||||
{
|
||||
|
|
|
@ -112,9 +112,9 @@ void Screen::update()
|
|||
// Refresh the screen
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
if (lcd_needsupdate)
|
||||
if (lcd_needsupdate != lcd_update)
|
||||
{
|
||||
lcd_needsupdate = 0;
|
||||
lcd_update = lcd_needsupdate;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -139,7 +139,6 @@ void Screen::update()
|
|||
}
|
||||
pt.end();
|
||||
|
||||
|
||||
mainScreen->setPixmap(mainPixmap);
|
||||
QGraphicsView::update();
|
||||
screenTimer.setSingleShot(true);
|
||||
|
|
|
@ -59,6 +59,8 @@ public:
|
|||
QGraphicsPixmapItem *mainScreen;
|
||||
QPixmap mainPixmap;
|
||||
|
||||
int lcd_update;
|
||||
|
||||
public:
|
||||
explicit Screen(QWidget *parent = 0);
|
||||
~Screen();
|
||||
|
|
Loading…
Reference in a new issue