- fixed calculation of glow color

Width and pitch were mixed up for RGB format texture, pixel data were read outside of designated buffer

https://forum.zdoom.org/viewtopic.php?t=60538
This commit is contained in:
alexey.lysiuk 2018-05-10 15:45:29 +03:00
parent 46e2e0b57c
commit a7e7db1fe9

View file

@ -1136,10 +1136,10 @@ void FTexture::GetGlowColor(float *data)
if (bGlowing && GlowColor == 0)
{
int w = Width, h = Height;
auto buffer = new uint8_t[w * h];
auto buffer = new uint8_t[w * h * 4];
if (buffer)
{
FillBuffer(buffer, w, h, TEX_RGB);
FillBuffer(buffer, w * 4, h, TEX_RGB);
GlowColor = averageColor((uint32_t *)buffer, w*h, 153);
delete[] buffer;
}