diff --git a/.vscode/settings.json b/.vscode/settings.json index f355019cf..fb31d406b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -23,6 +23,7 @@ "tuple": "cpp", "utility": "cpp", "*.tcc": "cpp", - "functional": "cpp" + "functional": "cpp", + "iomanip": "cpp" } } diff --git a/src/common/sdl_blitter/HqBlitter.cxx b/src/common/sdl_blitter/HqBlitter.cxx index a47cd003b..ae1baea06 100644 --- a/src/common/sdl_blitter/HqBlitter.cxx +++ b/src/common/sdl_blitter/HqBlitter.cxx @@ -106,6 +106,8 @@ void HqBlitter::blitToIntermediate() SDL_Rect r = mySrcRect; r.x = r.y = 0; + SDL_UpdateTexture(myIntermediateTexture, nullptr, myBlankBuffer.get(), 4 * myIntermediateRect.w); + SDL_SetRenderTarget(myFB.renderer(), myIntermediateTexture); SDL_RenderCopy(myFB.renderer(), mySrcTexture, &r, &myIntermediateRect); @@ -138,6 +140,9 @@ void HqBlitter::recreateTexturesIfNecessary() mySrcTexture = SDL_CreateTexture(myFB.renderer(), myFB.pixelFormat().format, texAccess, mySrcRect.w, mySrcRect.h); + myBlankBuffer = make_unique(4 * myIntermediateRect.w * myIntermediateRect.h); + memset(myBlankBuffer.get(), 0, 4 * myIntermediateRect.w * myIntermediateRect.h); + SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, myAttributes.smoothing ? "1" : "0"); myIntermediateTexture = SDL_CreateTexture(myFB.renderer(), myFB.pixelFormat().format, diff --git a/src/common/sdl_blitter/HqBlitter.hxx b/src/common/sdl_blitter/HqBlitter.hxx index 745f869b1..8c60de00e 100644 --- a/src/common/sdl_blitter/HqBlitter.hxx +++ b/src/common/sdl_blitter/HqBlitter.hxx @@ -54,6 +54,7 @@ class HqBlitter : public Blitter { bool myRecreateTextures; SDL_Surface* myStaticData; + unique_ptr myBlankBuffer; FrameBufferSDL2& myFB;