From 8ca05fe30ab9a3313e6b1016dc673cc76548fdc3 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 1 Dec 2019 22:05:10 +0100 Subject: [PATCH] Implement crossfade --- .../polyrenderer/backend/poly_hwtexture.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/rendering/polyrenderer/backend/poly_hwtexture.cpp b/src/rendering/polyrenderer/backend/poly_hwtexture.cpp index cd3102b53..a16b58287 100644 --- a/src/rendering/polyrenderer/backend/poly_hwtexture.cpp +++ b/src/rendering/polyrenderer/backend/poly_hwtexture.cpp @@ -121,6 +121,22 @@ void PolyHardwareTexture::CreateWipeTexture(int w, int h, const char *name) mCanvas.reset(new DCanvas(0, 0, true)); mCanvas->Resize(w, h, false); } + + auto fb = static_cast(screen); + + fb->FlushDrawCommands(); + DrawerThreads::WaitForWorkers(); + + uint32_t* dest = (uint32_t*)mCanvas->GetPixels(); + uint32_t* src = (uint32_t*)fb->GetCanvas()->GetPixels(); + int dpitch = mCanvas->GetPitch(); + int spitch = fb->GetCanvas()->GetPitch(); + int pixelsize = 4; + + for (int y = 0; y < h; y++) + { + memcpy(dest + dpitch * (h - 1 - y), src + spitch * y, w * pixelsize); + } } void PolyHardwareTexture::CreateImage(FTexture *tex, int translation, int flags)