Dialogs drawn outside the underlying basedialog area no longer leave parts around.

There is still some work TODO for TIA mode; that is coming next.
This commit is contained in:
Stephen Anthony 2019-06-03 14:32:59 -02:30
parent 6153b8aa6c
commit d7754aee77
5 changed files with 14 additions and 35 deletions

View File

@ -306,11 +306,7 @@ bool FrameBufferSDL2::setVideoMode(const string& title, const VideoMode& mode)
Logger::log(msg, 0);
return false;
}
// Always clear the (double-buffered) renderer surface
SDL_RenderClear(myRenderer);
SDL_RenderPresent(myRenderer);
SDL_RenderClear(myRenderer);
clear();
SDL_RendererInfo renderinfo;
if(SDL_GetRendererInfo(myRenderer, &renderinfo) >= 0)
@ -352,15 +348,6 @@ string FrameBufferSDL2::about() const
return out.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL2::invalidate()
{
ASSERT_MAIN_THREAD;
SDL_RenderClear(myRenderer);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL2::showCursor(bool show)
{
@ -436,6 +423,7 @@ void FrameBufferSDL2::readPixels(uInt8* pixels, uInt32 pitch,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBufferSDL2::clear()
{
invalidate();
renderToScreen();
ASSERT_MAIN_THREAD;
SDL_RenderClear(myRenderer);
}

View File

@ -112,7 +112,7 @@ class FrameBufferSDL2 : public FrameBuffer
void updateWindowedPos() override;
/**
Clear the frame buffer
Clear the frame buffer.
*/
void clear() override;
@ -143,13 +143,6 @@ class FrameBufferSDL2 : public FrameBuffer
*/
bool setVideoMode(const string& title, const VideoMode& mode) override;
/**
This method is called to invalidate the contents of the entire
framebuffer (ie, mark the current content as invalid, and erase it on
the next drawing pass).
*/
void invalidate() override;
/**
This method is called to create a surface with the given attributes.
@ -189,7 +182,7 @@ class FrameBufferSDL2 : public FrameBuffer
// Used by mapRGB (when palettes are created)
SDL_PixelFormat* myPixelFormat;
// center setting of curent window
// Center setting of current window
bool myCenter;
// last position of windowed window

View File

@ -944,7 +944,8 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
{
// Windowed and fullscreen mode differ only in screen size
myWindowedModeList.add(
VideoMode(baseWidth, baseHeight, baseWidth, baseHeight, VideoMode::Stretch::None)
VideoMode(baseWidth, baseHeight, baseWidth, baseHeight,
VideoMode::Stretch::None)
);
for(uInt32 i = 0; i < myFullscreenDisplays.size(); ++i)
{
@ -1069,10 +1070,11 @@ FrameBuffer::VideoMode::VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh,
{
case Stretch::Preserve:
case Stretch::Fill:
case Stretch::None:
screen.w = iw;
screen.h = ih;
break;
case Stretch::None:
break; // Do not change image or screen rects whatsoever
}
}

View File

@ -73,7 +73,8 @@ class FrameBuffer
friend ostream& operator<<(ostream& os, const VideoMode& vm)
{
os << "image=" << vm.image << " screen=" << vm.screen
<< " stretch= " << (vm.stretch == Stretch::Preserve ? "preserve" : "fill")
<< " stretch=" << (vm.stretch == Stretch::Preserve ? "preserve" :
vm.stretch == Stretch::Fill ? "fill" : "none")
<< " desc=" << vm.description << " zoom=" << vm.zoom
<< " fsIndex= " << vm.fsIndex;
return os;
@ -391,13 +392,6 @@ class FrameBuffer
virtual bool setVideoMode(const string& title,
const FrameBuffer::VideoMode& mode) = 0;
/**
This method is called to invalidate the contents of the entire
framebuffer (ie, mark the current content as invalid, and erase it on
the next drawing pass).
*/
virtual void invalidate() = 0;
/**
This method is called to create a surface with the given attributes.

View File

@ -94,6 +94,8 @@ bool DialogContainer::draw(bool full)
// If the top dialog is dirty, then all below it must be redrawn too
bool dirty = needsRedraw();
if(dirty)
myOSystem.frameBuffer().clear();
myDialogStack.applyAll([&](Dialog*& d){
if(dirty)