mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-19 16:11:23 +00:00
- fixed bad texture canvas checks when in truecolor software rendering.
This commit is contained in:
parent
53c2d7e8d2
commit
1e4a32004b
1 changed files with 7 additions and 11 deletions
|
@ -153,23 +153,15 @@ void FSWCanvasTexture::Unload ()
|
||||||
void FSWCanvasTexture::UpdatePixels(bool truecolor)
|
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)
|
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).
|
// True color render still sometimes uses palette textures (for sprites, mostly).
|
||||||
// We need to make sure that both pixel buffers contain data:
|
// We need to make sure that both pixel buffers contain data:
|
||||||
int width = GetWidth();
|
int width = GetWidth();
|
||||||
int height = GetHeight();
|
int height = GetHeight();
|
||||||
uint8_t *palbuffer = const_cast<uint8_t*>(GetPixels(0));
|
uint8_t* palbuffer = const_cast<uint8_t*>(GetPixels(0));
|
||||||
const uint32_t *bgrabuffer = GetPixelsBgra();
|
const uint32_t* bgrabuffer = GetPixelsBgra();
|
||||||
for (int x = 0; x < width; x++)
|
for (int x = 0; x < width; x++)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < height; y++)
|
for (int y = 0; y < height; y++)
|
||||||
|
@ -184,6 +176,10 @@ void FSWCanvasTexture::UpdatePixels(bool truecolor)
|
||||||
bgrabuffer += height;
|
bgrabuffer += height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImageHelpers::FlipNonSquareBlockRemap(Pixels.Data(), Canvas->GetPixels(), GetWidth(), GetHeight(), Canvas->GetPitch(), GPalette.Remap);
|
||||||
|
}
|
||||||
|
|
||||||
static_cast<FCanvasTexture*>(mTexture)->SetUpdated(false);
|
static_cast<FCanvasTexture*>(mTexture)->SetUpdated(false);
|
||||||
}
|
}
|
Loading…
Reference in a new issue