GRAPHICS: Fix UB when bytesPerPixel == 4
It doesn't even work on x86(_64) as 1 is not shifted
This commit is contained in:
parent
a110714141
commit
faa16c9023
1 changed files with 2 additions and 1 deletions
|
@ -248,7 +248,8 @@ CursorManager::Cursor::Cursor(const void *data, uint w, uint h, int hotspotX, in
|
|||
else
|
||||
_format = *format;
|
||||
_size = w * h * _format.bytesPerPixel;
|
||||
_keycolor = keycolor & ((1 << (_format.bytesPerPixel << 3)) - 1);
|
||||
const uint32 keycolor_mask = (((uint32) -1) >> (sizeof(uint32) * 8 - _format.bytesPerPixel * 8));
|
||||
_keycolor = keycolor & keycolor_mask;
|
||||
#else
|
||||
_format = Graphics::PixelFormat::createFormatCLUT8();
|
||||
_size = w * h;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue