mirror of
https://github.com/libretro/stella2023.git
synced 2024-11-27 10:50:38 +00:00
improved the code for rendering non-rounded bezels only on load (this should work)
This commit is contained in:
parent
e76b91720d
commit
647f3d48a5
@ -227,24 +227,11 @@ void Bezel::apply()
|
||||
mySurface->applyAttributes();
|
||||
mySurface->setVisible(true);
|
||||
}
|
||||
else
|
||||
if(mySurface)
|
||||
mySurface->setVisible(false);
|
||||
|
||||
// If the bezel window is not rounded, it has to be rendered only once for each buffer
|
||||
if(mySurface && !myInfo.isRounded())
|
||||
myRenderCount = 2; // double buffering
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Bezel::render(bool force)
|
||||
{
|
||||
if(myRenderCount)
|
||||
{
|
||||
force = true;
|
||||
myRenderCount--;
|
||||
}
|
||||
|
||||
// Only bezels with rounded windows have to be rendered each frame
|
||||
if(mySurface && (myInfo.isRounded() || force))
|
||||
mySurface->render();
|
||||
|
@ -135,8 +135,6 @@ class Bezel
|
||||
// The bezel surface which blends over the TIA surface
|
||||
shared_ptr<FBSurface> mySurface;
|
||||
|
||||
uInt32 myRenderCount{0};
|
||||
|
||||
// Bezel info structure
|
||||
Info myInfo;
|
||||
|
||||
|
@ -588,7 +588,7 @@ void FrameBuffer::updateInEmulationMode(float framesPerSecond)
|
||||
// We don't worry about selective rendering here; the rendering
|
||||
// always happens at the full framerate
|
||||
|
||||
renderTIA(false);
|
||||
renderTIA(false); // do not clear screen in emulation mode
|
||||
|
||||
// Show frame statistics
|
||||
if(myStatsMsg.enabled)
|
||||
@ -1269,23 +1269,34 @@ void FrameBuffer::toggleBezel(bool toggle)
|
||||
{
|
||||
bool enabled = myOSystem.settings().getBool("bezel.show");
|
||||
|
||||
if(toggle)
|
||||
if(toggle && myBufferType == BufferType::Emulator)
|
||||
{
|
||||
if(myBufferType == BufferType::Emulator &&
|
||||
(fullScreen() || myOSystem.settings().getBool("bezel.windowed")))
|
||||
if(!fullScreen() && !myOSystem.settings().getBool("bezel.windowed"))
|
||||
{
|
||||
myOSystem.frameBuffer().showTextMessage("Bezels in windowed mode are not enabled");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
enabled = !enabled;
|
||||
myOSystem.settings().setValue("bezel.show", enabled);
|
||||
myBezel->load();
|
||||
if(!myBezel->load() && enabled)
|
||||
{
|
||||
myOSystem.settings().setValue("bezel.show", !enabled);
|
||||
myOSystem.frameBuffer().showTextMessage("No bezel image found");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Determine possible TIA windowed zoom levels
|
||||
const double currentTIAZoom =
|
||||
static_cast<double>(myOSystem.settings().getFloat("tia.zoom"));
|
||||
myOSystem.settings().setValue("tia.zoom",
|
||||
BSPF::clamp(currentTIAZoom, supportedTIAMinZoom(), supportedTIAMaxZoom()));
|
||||
|
||||
// Determine possible TIA windowed zoom levels
|
||||
const double currentTIAZoom =
|
||||
static_cast<double>(myOSystem.settings().getFloat("tia.zoom"));
|
||||
myOSystem.settings().setValue("tia.zoom",
|
||||
BSPF::clamp(currentTIAZoom, supportedTIAMinZoom(), supportedTIAMaxZoom()));
|
||||
|
||||
saveCurrentWindowPosition();
|
||||
applyVideoMode();
|
||||
saveCurrentWindowPosition();
|
||||
applyVideoMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
myOSystem.frameBuffer().showTextMessage(enabled ? "Bezel enabled" : "Bezel disabled");
|
||||
@ -1298,6 +1309,11 @@ FBInitStatus FrameBuffer::applyVideoMode()
|
||||
const Settings& s = myOSystem.settings();
|
||||
const int display = displayId();
|
||||
|
||||
// Get rid of the previous output
|
||||
myBackend->clear();
|
||||
myBackend->renderToScreen();
|
||||
myBackend->clear();
|
||||
|
||||
if(s.getBool("fullscreen"))
|
||||
myVidModeHandler.setDisplaySize(myFullscreenDisplays[display], display);
|
||||
else
|
||||
@ -1333,6 +1349,13 @@ FBInitStatus FrameBuffer::applyVideoMode()
|
||||
{
|
||||
#ifdef IMAGE_SUPPORT
|
||||
myBezel->apply();
|
||||
if(!myBezel->info().isRounded())
|
||||
{
|
||||
// If the bezel window is not rounded, it has to be rendered only once for each buffer
|
||||
myBezel->render(true);
|
||||
myBackend->renderToScreen();
|
||||
myBezel->render(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
myTIASurface->initialize(myOSystem.console(), myActiveVidMode);
|
||||
|
Loading…
Reference in New Issue
Block a user