From 2202f5890198bbe5cbfdacd4ce686efc83f84187 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Mon, 21 Aug 2023 10:50:47 +0200 Subject: [PATCH] fixed bezel blend mode bug (only showed with TV-effects && Interpolation enabled) changed default hotkey for correct aspect ratio --- src/common/PKeyboardHandler.cxx | 2 +- src/common/sdl_blitter/BilinearBlitter.cxx | 10 +++++----- src/emucore/FrameBuffer.cxx | 15 +++++++++++---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx index d88f94aef..601e83108 100644 --- a/src/common/PKeyboardHandler.cxx +++ b/src/common/PKeyboardHandler.cxx @@ -641,7 +641,7 @@ PhysicalKeyboardHandler::DefaultCommonMapping = { { Event::VCenterIncrease, KBDK_PAGEDOWN, MOD3 }, { Event::VSizeAdjustDecrease, KBDK_PAGEDOWN, KBDM_SHIFT | MOD3 }, { Event::VSizeAdjustIncrease, KBDK_PAGEUP, KBDM_SHIFT | MOD3 }, - { Event::ToggleCorrectAspectRatio, KBDK_C, KBDM_CTRL }, + { Event::ToggleCorrectAspectRatio, KBDK_C, KBDM_SHIFT | KBDM_CTRL }, { Event::VolumeDecrease, KBDK_LEFTBRACKET, MOD3 }, { Event::VolumeIncrease, KBDK_RIGHTBRACKET, MOD3 }, { Event::SoundToggle, KBDK_RIGHTBRACKET, KBDM_CTRL }, diff --git a/src/common/sdl_blitter/BilinearBlitter.cxx b/src/common/sdl_blitter/BilinearBlitter.cxx index 9235a62b0..a8b75ebab 100644 --- a/src/common/sdl_blitter/BilinearBlitter.cxx +++ b/src/common/sdl_blitter/BilinearBlitter.cxx @@ -125,12 +125,12 @@ void BilinearBlitter::recreateTexturesIfNecessary() SDL_UpdateTexture(myTexture, nullptr, myStaticData->pixels, myStaticData->pitch); } - const std::array textures = { myTexture, mySecondaryTexture }; - for (SDL_Texture* texture: textures) { - if (!texture) continue; + if (myAttributes.blending) { + const std::array textures = { myTexture, mySecondaryTexture }; + for (SDL_Texture* texture: textures) { + if (!texture) continue; - SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND); - if (myAttributes.blending) { + SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND); const auto blendAlpha = static_cast(myAttributes.blendalpha * 2.55); SDL_SetTextureAlphaMod(texture, blendAlpha); } diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index 0010ba982..c8f2734b7 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -1376,14 +1376,21 @@ bool FrameBuffer::loadBezel() if(isValid) { // Scale bezel to fullscreen (preserve or stretch) or window size - const uInt32 bezelH = std::min(myActiveVidMode.screenS.h, - myActiveVidMode.imageR.h()); - const uInt32 bezelW = std::min(myActiveVidMode.screenS.w, - static_cast(bezelH * (16.F / 9.F))); + const uInt32 bezelW = std::min( + myActiveVidMode.screenS.w, + static_cast(myActiveVidMode.imageR.w() * (16.F / 9.F) / (4.F / 3.F))); + const uInt32 bezelH = std::min( + myActiveVidMode.screenS.h, + myActiveVidMode.imageR.h()); + cerr << bezelW << " x " << bezelH << endl; myBezelSurface->setDstSize(bezelW, bezelH); myBezelSurface->setDstPos((myActiveVidMode.screenS.w - bezelW) / 2, (myActiveVidMode.screenS.h - bezelH) / 2); // center myBezelSurface->setScalingInterpolation(ScalingInterpolation::sharp); + + myBezelSurface->attributes().blending = true; + myBezelSurface->attributes().blendalpha = 100; + myBezelSurface->applyAttributes(); } if(myBezelSurface) myBezelSurface->setVisible(isValid);