From 1e4a32004b7d89d797d3b2c1dbb68c9189b46440 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 9 Aug 2019 13:59:54 +0200 Subject: [PATCH] - fixed bad texture canvas checks when in truecolor software rendering. --- .../swrenderer/textures/swcanvastexture.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/rendering/swrenderer/textures/swcanvastexture.cpp b/src/rendering/swrenderer/textures/swcanvastexture.cpp index 8c47ad1523..c3d12e33ee 100644 --- a/src/rendering/swrenderer/textures/swcanvastexture.cpp +++ b/src/rendering/swrenderer/textures/swcanvastexture.cpp @@ -153,23 +153,15 @@ void FSWCanvasTexture::Unload () void FSWCanvasTexture::UpdatePixels(bool truecolor) { - if (Canvas->IsBgra()) - { - ImageHelpers::FlipNonSquareBlock(PixelsBgra.Data(), (const uint32_t*)Canvas->GetPixels(), GetWidth(), GetHeight(), Canvas->GetPitch()); - } - else - { - ImageHelpers::FlipNonSquareBlockRemap(Pixels.Data(), Canvas->GetPixels(), GetWidth(), GetHeight(), Canvas->GetPitch(), GPalette.Remap); - } - if (truecolor) { + ImageHelpers::FlipNonSquareBlock(PixelsBgra.Data(), (const uint32_t*)CanvasBgra->GetPixels(), GetWidth(), GetHeight(), CanvasBgra->GetPitch()); // True color render still sometimes uses palette textures (for sprites, mostly). // We need to make sure that both pixel buffers contain data: int width = GetWidth(); int height = GetHeight(); - uint8_t *palbuffer = const_cast(GetPixels(0)); - const uint32_t *bgrabuffer = GetPixelsBgra(); + uint8_t* palbuffer = const_cast(GetPixels(0)); + const uint32_t* bgrabuffer = GetPixelsBgra(); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) @@ -184,6 +176,10 @@ void FSWCanvasTexture::UpdatePixels(bool truecolor) bgrabuffer += height; } } + else + { + ImageHelpers::FlipNonSquareBlockRemap(Pixels.Data(), Canvas->GetPixels(), GetWidth(), GetHeight(), Canvas->GetPitch(), GPalette.Remap); + } static_cast(mTexture)->SetUpdated(false); } \ No newline at end of file