mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
Proper fix for .cur loading bug
This commit is contained in:
parent
3ca1f47ea1
commit
b4508cbc99
@ -2044,14 +2044,12 @@ read_ico(istream &ico) {
|
|||||||
if (infoHeader.compression != 0) goto cleanup;
|
if (infoHeader.compression != 0) goto cleanup;
|
||||||
|
|
||||||
// Load the color palette, if one exists.
|
// Load the color palette, if one exists.
|
||||||
colorCount = entries[entry].colorCount == 0 ? 256 : entries[entry].colorCount;
|
if (bitsPerPixel != 24 && bitsPerPixel != 32) {
|
||||||
// FIXME: this is probably not a proper fix:
|
colorCount = 1 << bitsPerPixel;
|
||||||
if (bitsPerPixel == 1) {
|
|
||||||
colorCount = 2;
|
|
||||||
}
|
|
||||||
palette = new IcoColor[colorCount];
|
palette = new IcoColor[colorCount];
|
||||||
if (bitsPerPixel <= 8) ico.read(reinterpret_cast<char *>(palette), colorCount * sizeof(IcoColor));
|
ico.read(reinterpret_cast<char *>(palette), colorCount * sizeof(IcoColor));
|
||||||
if (!ico.good()) goto cleanup;
|
if (!ico.good()) goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
// Read in the pixel data.
|
// Read in the pixel data.
|
||||||
xorBmpSize = (infoHeader.width * (infoHeader.height / 2) * bitsPerPixel) / 8;
|
xorBmpSize = (infoHeader.width * (infoHeader.height / 2) * bitsPerPixel) / 8;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user