activated enhanced "full" redraw logic

This commit is contained in:
thrust26 2020-11-11 15:37:32 +01:00
parent 7d63a0dfb8
commit 9f88a116a4
2 changed files with 24 additions and 37 deletions

View File

@ -323,13 +323,14 @@ void FrameBuffer::update(bool force)
// last, since they are always drawn on top of everything else). // last, since they are always drawn on top of everything else).
// Full rendering is required when messages are enabled // Full rendering is required when messages are enabled
force = force || myMsg.counter >= 0; force |= (myMsg.counter >= 0);
// Detect when a message has been turned off; one last redraw is required // Detect when a message has been turned off; one last redraw is required
// in this case, to draw over the area that the message occupied // in this case, to draw over the area that the message occupied
if(myMsg.counter == 0) if(myMsg.counter == 0)
myMsg.counter = -1; myMsg.counter = -1;
bool redraw = false;
switch(myOSystem.eventHandler().state()) switch(myOSystem.eventHandler().state())
{ {
case EventHandlerState::NONE: case EventHandlerState::NONE:
@ -354,8 +355,8 @@ void FrameBuffer::update(bool force)
#ifdef GUI_SUPPORT #ifdef GUI_SUPPORT
case EventHandlerState::OPTIONSMENU: case EventHandlerState::OPTIONSMENU:
{ {
force = force || myOSystem.menu().needsRedraw(); redraw = myOSystem.menu().needsRedraw();
if(force) if(force || redraw)
{ {
clear(); clear();
myTIASurface->render(); myTIASurface->render();
@ -366,8 +367,8 @@ void FrameBuffer::update(bool force)
case EventHandlerState::CMDMENU: case EventHandlerState::CMDMENU:
{ {
force = force || myOSystem.commandMenu().needsRedraw(); redraw = myOSystem.commandMenu().needsRedraw();
if(force) if(force || redraw)
{ {
clear(); clear();
myTIASurface->render(); myTIASurface->render();
@ -378,8 +379,8 @@ void FrameBuffer::update(bool force)
case EventHandlerState::MESSAGEMENU: case EventHandlerState::MESSAGEMENU:
{ {
force = force || myOSystem.messageMenu().needsRedraw(); redraw = myOSystem.messageMenu().needsRedraw();
if (force) if(force || redraw)
{ {
clear(); clear();
myTIASurface->render(); myTIASurface->render();
@ -390,8 +391,8 @@ void FrameBuffer::update(bool force)
case EventHandlerState::TIMEMACHINE: case EventHandlerState::TIMEMACHINE:
{ {
force = force || myOSystem.timeMachine().needsRedraw(); redraw = myOSystem.timeMachine().needsRedraw();
if(force) if(force || redraw)
{ {
clear(); clear();
myTIASurface->render(); myTIASurface->render();
@ -436,10 +437,9 @@ void FrameBuffer::update(bool force)
case EventHandlerState::LAUNCHER: case EventHandlerState::LAUNCHER:
{ {
force = force || myOSystem.launcher().needsRedraw(); redraw = myOSystem.launcher().needsRedraw();
if(force) if(force || redraw)
{ {
//clear();
myOSystem.launcher().draw(force); myOSystem.launcher().draw(force);
} }
break; // EventHandlerState::LAUNCHER break; // EventHandlerState::LAUNCHER
@ -449,10 +449,10 @@ void FrameBuffer::update(bool force)
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
case EventHandlerState::DEBUGGER: case EventHandlerState::DEBUGGER:
{ {
force = force || myOSystem.debugger().needsRedraw(); redraw = myOSystem.debugger().needsRedraw();
if(force) if(force || redraw)
{ {
clear();
myOSystem.debugger().draw(force); myOSystem.debugger().draw(force);
} }
break; // EventHandlerState::DEBUGGER break; // EventHandlerState::DEBUGGER
@ -471,7 +471,7 @@ void FrameBuffer::update(bool force)
drawMessage(); drawMessage();
// Push buffers to screen only when necessary // Push buffers to screen only when necessary
if(force) if(force || redraw)
myBackend->renderToScreen(); myBackend->renderToScreen();
} }

View File

@ -91,32 +91,19 @@ void DialogContainer::updateTime(uInt64 time)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool DialogContainer::draw(bool full) bool DialogContainer::draw(bool full)
{ {
//cerr << "draw " << full << endl; cerr << "draw " << full << " " << typeid(*this).name() << endl;
if(myDialogStack.empty()) if(myDialogStack.empty())
return false; return false;
// Make the top dialog dirty if a full redraw is requested // Make the top dialog dirty if a full redraw is requested
//if(full) if(full)
// myDialogStack.top()->setDirty(); myDialogStack.top()->setDirty();
// If the top dialog is dirty, then all below it must be redrawn too // Render all dirty dialogs
const bool dirty = needsRedraw(); myDialogStack.applyAll([&](Dialog*& d) {
//if(dirty) if(d->needsRedraw())
// myDialogStack.top()->setDirty(); full |= d->render();
});
//myDialogStack.applyAll([&](Dialog*& d){
// if(dirty)
// d->setDirty();
// full |= d->render();
//});
//if(dirty)
{
myDialogStack.applyAll([&](Dialog*& d) {
if(d->needsRedraw())
//d->setDirty();
full |= d->render();
});
}
return full; return full;
} }