From d3b46c742d14b324d3775101116ddf2296fbbd17 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Sat, 19 Aug 2023 19:25:50 +0200 Subject: [PATCH] some small fixes --- src/emucore/FrameBuffer.cxx | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index 3fd33239e..089285943 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -1301,7 +1301,15 @@ FBInitStatus FrameBuffer::applyVideoMode() // Inform TIA surface about new mode, and update TIA settings if(inTIAMode) { - myTIASurface->initialize(myOSystem.console(), myActiveVidMode); +#ifdef IMAGE_SUPPORT + if(myBezelSurface) + deallocateSurface(myBezelSurface); + myBezelSurface = nullptr; + if(showBezel) + loadBezel(); +#endif + + myTIASurface->initialize(myOSystem.console(), myActiveVidMode); if(fullScreen()) myOSystem.settings().setValue("tia.fs_stretch", myActiveVidMode.stretch == VideoModeHandler::Mode::Stretch::Fill); @@ -1309,13 +1317,6 @@ FBInitStatus FrameBuffer::applyVideoMode() myOSystem.settings().setValue("tia.zoom", myActiveVidMode.zoom); } -#ifdef IMAGE_SUPPORT - if(myBezelSurface) - deallocateSurface(myBezelSurface); - if(showBezel) - loadBezel(); -#endif - resetSurfaces(); setCursorState(); myPendingRender = true; @@ -1376,8 +1377,11 @@ bool FrameBuffer::loadBezel() // Scale bezel to fullscreen (preserve or stretch) or window size const uInt32 bezelH = std::min(myActiveVidMode.screenS.h, myActiveVidMode.imageR.h()); - myBezelSurface->setDstSize(myActiveVidMode.screenS.w, bezelH); - myBezelSurface->setDstPos(0, (myActiveVidMode.screenS.h - bezelH) / 2); // center vertically + const uInt32 bezelW = std::min(myActiveVidMode.screenS.w, + static_cast(bezelH * (16.F / 9.F))); + myBezelSurface->setDstSize(bezelW, bezelH); + myBezelSurface->setDstPos((myActiveVidMode.screenS.w - bezelW) / 2, + (myActiveVidMode.screenS.h - bezelH) / 2); // center myBezelSurface->setScalingInterpolation(ScalingInterpolation::sharp); } if(myBezelSurface)