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 2986 - SDL_FillRect onto a 24-bit surface swaps Red and Blue component
Summary: SDL_FillRect onto a 24-bit surface swaps Red and Blue component
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.3
Hardware: x86 Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-17 17:09 UTC by Dávid Nagy
Modified: 2015-05-31 15:38 UTC (History)
1 user (show)

See Also:


Attachments
Testcase (729 bytes, application/zip)
2015-05-17 17:09 UTC, Dávid Nagy
Details
My proposed fix. (1017 bytes, patch)
2015-05-17 17:25 UTC, Dávid Nagy
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dávid Nagy 2015-05-17 17:09:41 UTC
Created attachment 2155 [details]
Testcase

When using SDL_FillRect on a 24-bit surface, the Red and Blue components of the fill color are swapped.
16-bit and 32-bit surfaces don't have this problem.

The testcase should make a testcase_out.bmp filled with orange (255,192,128), but it becomes blue (128,192,255).
Comment 1 Dávid Nagy 2015-05-17 17:25:06 UTC
Created attachment 2156 [details]
My proposed fix.

Apply to SDL2-2.0.3/src/video/SDL_fillrect.c
Disclaimer: Although I separated the two cases of endianness, I tested it only on a little-endian system.
Comment 2 Ryan C. Gordon 2015-05-31 15:38:41 UTC
This patch is now https://hg.libsdl.org/SDL/rev/596a3da0c9cb, thanks!

--ryan.