We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 608 - missing 24 bpp surface handling in SDL_MasksToPixelFormatEnum()
Summary: missing 24 bpp surface handling in SDL_MasksToPixelFormatEnum()
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86 All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-31 10:08 UTC by David HENRY
Modified: 2009-06-10 03:53 UTC (History)
1 user (show)

See Also:


Attachments
fix 24 bpp image handling in SDL_MasksToPixelFormatEnum() (497 bytes, patch)
2008-09-21 04:18 UTC, David HENRY
Details | Diff
24-bits JPEG test image (7.00 KB, image/jpeg)
2009-02-16 22:27 UTC, David HENRY
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David HENRY 2008-07-31 10:08:14 UTC
The function SDL_MasksToPixelFormatEnum() in video/SDL_pixel.c does not handle 24 bpp surfaces. Therefore when loading 24 bit pictures with SDL_image, this function returns always 0...
Comment 1 David HENRY 2008-09-21 04:18:17 UTC
Created attachment 279 [details]
fix 24 bpp image handling in SDL_MasksToPixelFormatEnum()

I attached a little patch to add 24 bpp image handling in SDL_MasksToPixelFormatEnum(), but this raises a new issue: this function
doesn't handle endianess at all.

Is it normal? Or am I doing it wrong in my application when creating my
texture from an SDL surface?
Comment 2 Sam Lantinga 2009-02-16 21:07:14 UTC
Can you attach a sample image?  You're right, endianness needs to be taken into account, but I can take care of that once I have a test case.

Thanks!
Comment 3 David HENRY 2009-02-16 22:27:18 UTC
Created attachment 297 [details]
24-bits JPEG test image

Here is one of my test images.
Comment 4 Mike Gorchak 2009-06-10 03:53:06 UTC
I commited a fix for this issue today. But one problem is still persist: RGB24 and BGR24 doesn't have masks, so it is impossible to determine by bpp in SDL_MasksToPixelFormatEnum() function which format to return: RGB24 or BGR24.