PICT: more accurate 5-5-5 to 8-8-8 RGB conversion

This commit is contained in:
Iliyas Jorio 2021-11-28 19:52:15 +01:00
parent 5ae74f079d
commit 1b0ea49ded
1 changed files with 7 additions and 3 deletions

View File

@ -189,10 +189,14 @@ static ARGBPixmap Unpack3(BigEndianIStream& f, int w, int h, UInt16 rowbytes)
LOG << "Chunky16 to RGBA";
for (UInt16 px : unpacked)
{
UInt8 r = ((px >> 10) & 0b11111) * 255 / 31;
UInt8 g = ((px >> 5) & 0b11111) * 255 / 31;
UInt8 b = ((px >> 0) & 0b11111) * 255 / 31;
dst.data.push_back(0xFF); // a
dst.data.push_back(((px >> 10) & 0x1F) << 3); // r
dst.data.push_back(((px >> 5) & 0x1F) << 3); // g
dst.data.push_back(((px >> 0) & 0x1F) << 3); // b
dst.data.push_back(r);
dst.data.push_back(g);
dst.data.push_back(b);
}
LOG_NOPREFIX << "\n";
return dst;