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

Summary: SDL_FillRect onto a 24-bit surface swaps Red and Blue component
Product: SDL Reporter: Dávid Nagy <nagydavid91>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus
Version: 2.0.3   
Hardware: x86   
OS: Linux   
Attachments: Testcase
My proposed fix.

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.