mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 20:20:40 +00:00
- texture manager fixes from GZDoom
* missing null check in FPngTexture. * ignore identity translations when creating textures.
This commit is contained in:
parent
f8ae35f8a5
commit
0314cdec55
5 changed files with 68 additions and 66 deletions
|
@ -106,7 +106,7 @@ void FAnmTexture::ReadFrame(uint8_t *pixels, uint8_t *palette)
|
|||
uint8_t *source = (uint8_t *)lump.GetMem();
|
||||
|
||||
anim_t anim;
|
||||
if (ANIM_LoadAnim(&anim, source, lump.GetSize()) >= 0)
|
||||
if (ANIM_LoadAnim(&anim, source, (int)lump.GetSize()) >= 0)
|
||||
{
|
||||
int numframes = ANIM_NumFrames(&anim);
|
||||
if (numframes >= 1)
|
||||
|
|
|
@ -360,7 +360,8 @@ void FPNGTexture::ReadAlphaRemap(FileReader *lump, uint8_t *alpharemap)
|
|||
uint8_t r = lump->ReadUInt8();
|
||||
uint8_t g = lump->ReadUInt8();
|
||||
uint8_t b = lump->ReadUInt8();
|
||||
alpharemap[i] = PaletteMap[i] == 0 ? 0 : Luminance(r, g, b);
|
||||
int palmap = PaletteMap ? PaletteMap[i] : i;
|
||||
alpharemap[i] = palmap == 0 ? 0 : Luminance(r, g, b);
|
||||
}
|
||||
lump->Seek(p, FileReader::SeekSet);
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@ enum ECreateTexBufferFlags
|
|||
CTF_Expand = 1, // create buffer with a one-pixel wide border
|
||||
CTF_Upscale = 2, // Upscale the texture
|
||||
CTF_CreateMask = 3, // Flags that are relevant for hardware texture creation.
|
||||
CTF_Indexed = 4, // Tell the backend to create an indexed texture.
|
||||
CTF_ProcessData = 8, // run postprocessing on the generated buffer. This is only needed when using the data for a hardware texture.
|
||||
CTF_CheckOnly = 16, // Only runs the code to get a content ID but does not create a texture. Can be used to access a caching system for the hardware textures.
|
||||
CTF_ProcessData = 4, // run postprocessing on the generated buffer. This is only needed when using the data for a hardware texture.
|
||||
CTF_CheckOnly = 8, // Only runs the code to get a content ID but does not create a texture. Can be used to access a caching system for the hardware textures.
|
||||
CTF_Indexed = 16 // Tell the backend to create an indexed texture.
|
||||
};
|
||||
|
||||
class FHardwareTextureContainer
|
||||
|
|
|
@ -357,6 +357,7 @@ FTextureBuffer FTexture::CreateTexBuffer(int translation, int flags)
|
|||
memset(buffer, 0, W * (H + 1) * 4);
|
||||
|
||||
auto remap = translation <= 0 ? nullptr : GPalette.TranslationToTable(translation);
|
||||
if (remap && remap->Inactive) remap = nullptr;
|
||||
if (remap) translation = remap->Index;
|
||||
FBitmap bmp(buffer, W * 4, W, H);
|
||||
|
||||
|
|
Loading…
Reference in a new issue