From 2e927c7026d25037638c4d77e212486e5f44d6bc Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sat, 15 Dec 2018 10:13:28 -0500 Subject: [PATCH] - port texture upscaler code to truecolour --- src/swrenderer/textures/r_swtexture.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/swrenderer/textures/r_swtexture.cpp b/src/swrenderer/textures/r_swtexture.cpp index 43d6405b29..a778456c0b 100644 --- a/src/swrenderer/textures/r_swtexture.cpp +++ b/src/swrenderer/textures/r_swtexture.cpp @@ -146,8 +146,24 @@ const uint32_t *FSoftwareTexture::GetPixelsBgra() { if (PixelsBgra.Size() == 0 || CheckModified(2)) { - FBitmap bitmap = mTexture->GetBgraBitmap(nullptr); - GenerateBgraFromBitmap(bitmap); + if (mPhysicalScale == 1) + { + FBitmap bitmap = mTexture->GetBgraBitmap(nullptr); + GenerateBgraFromBitmap(bitmap); + } + else + { + auto tempbuffer = mTexture->CreateTexBuffer(0, mBufferFlags); + PixelsBgra.Resize(GetWidth()*GetHeight()); + PalEntry *pe = (PalEntry*)tempbuffer.mBuffer; + for (int y = 0; y < GetHeight(); y++) + { + for (int x = 0; x < GetWidth(); x++) + { + PixelsBgra[y + x * GetHeight()] = pe[x + y * GetWidth()]; + } + } + } } return PixelsBgra.Data(); }