kimgio: write mask from ico plugin

some browsers for example do not load ICO images without mask apparently,
the mask just makes the image bigger in (data) size tho - the actual image
data is the same (32-bit depth BGRA)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-12-27 19:33:10 +02:00
parent aaea32c10c
commit ea22f815a4

View file

@ -330,7 +330,7 @@ bool ICOHandler::write(const QImage &image)
uint bmpheadersize = 40;
uint bmpwidth = bmpimage.width();
uint bmpheight = bmpimage.height();
uint bmpheight = (bmpimage.height() * 2);
ushort bmpplanes = 0;
ushort bmpbpp = bmpimage.depth();
uint bmpcompression = BMPCompression::CompressionRGB;
@ -366,6 +366,11 @@ bool ICOHandler::write(const QImage &image)
datastream.writeRawData(bmpimagebits, bmpimagesize);
#endif
const QImage bmpimagemask = bmpimage.createAlphaMask();
const char* bmpimagemaskbits = reinterpret_cast<const char*>(bmpimagemask.constBits());
uint bmpimagemasksize = bmpimagemask.byteCount();
datastream.writeRawData(bmpimagemaskbits, bmpimagemasksize);
return (datastream.status() == QDataStream::Ok);
}