Skip to content

core_surface.t: test/data/icon.bmp is really 4 bits per pixel #310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lighterowl
Copy link

@lighterowl lighterowl commented Jun 12, 2025

I wasn't able to track down the exact commit in SDL that caused this to start failing, but things are pretty clear after looking at the file that this test uses, i.e. test/data/icon.bmp. Here's a dump of the file's headers :

00000000: 424d 4202 0000 0000 0000 4200 0000 2800  BMB.......B...(.
00000010: 0000 2000 0000 2000 0000 0100 0400 0000  .. ... .........
00000020: 0000 0002 0000 6d0b 0000 6d0b 0000 0300  ......m...m.....
00000030: 0000 0300 0000                           ......

According to Wikipedia, the first 14 bytes are the standard "Bitmap file header". Four-byte integer at offset 0x0E is 0x28 which means BITMAPINFOHEADER so the number of bits per pixel is stored as a two-byte integer at offset 0x1C, which is indeed 4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant