Fix transparency in 16 bit and 24 bit ico files
Hello. I have landed a small patch into upstream Qt 5.15 that impacts KDE. I am not sure if it is worth a cherry-pick, considering it is not a very severe issue. In any case...
The upstream patch: https://codereview.qt-project.org/c/qt/qtbase/+/490250
KDE bug: https://bugs.kde.org/show_bug.cgi?id=472208
Qt bug: https://bugreports.qt.io/browse/QTBUG-113319
The original Gerrit changeset description is attached below (and retained in the commit message.)
As a result of the fix for QTBUG-75214, Qt inadvertently no longer
reads the AND mask that specifies transparency for 16-bit and 24-bit
ico files. This is because it tries to detect 32-bit icons by checking
icoAttrib.depth == 32, but icoAttrib.depth is set to the depth of the
QImage, not the depth of the icon, and 32-bit QImage is used for all of
the non-indexed cases (16-bit, 24-bit and 32-bit.)
This commit instead uses icoAttrib.nbits, which should reliably
determine whether or not the icon is 32-bit. This makes the behavior
consistent with other ico reading software, including Windows.
Also, adds a unit test that verifies correct behavior of icon masks,
checking for both QTBUG-75214 and QTBUG-113319.
Amends 1d128ed1dfbcf49453ada922e54381c37264fde5.
Fixes: QTBUG-113319
Change-Id: I89ac86ff16054c8925fff6afc8c530fa737f8385
Pick-to: 6.6 6.5 6.2 5.15
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>