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 20 - 32bpp RGBA->RGB colorkey blit, no SDL_SRCALPHA
Summary: 32bpp RGBA->RGB colorkey blit, no SDL_SRCALPHA
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 1.2
Hardware: All All
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-03 12:10 UTC by Ryan C. Gordon
Modified: 2006-03-15 10:43 UTC (History)
1 user (show)

See Also:


Attachments
32bpp RGBA->RGB colorkey blit, no SDL_SRCALPHA patch (966 bytes, patch)
2006-01-03 12:11 UTC, Ryan C. Gordon
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan C. Gordon 2006-01-03 12:10:32 UTC
From: "Alex Volkov" <avcp-sdlmail@usa.net>
To: sdl@libsdl.org
Date: Thu, 10 Nov 2005 21:53:40 -0500
Subject: [SDL] BUG[?]: 32bpp RGBA->RGB colorkey blit, no SDL_SRCALPHA

It seems there is either a documentation vs. reality mismatch or a real bug
in SDL_blit_N.c:BlitNtoNKey().
The exact blit in question is a 32bpp RGBA->RGB, where RGBA has SDL_COLORKEY
and *no* SDL_SRCALPHA flags. The doc in SDL_video.h states:
* RGBA->RGB:
*     SDL_SRCALPHA not set:
*       copy RGB.
*       if SDL_SRCCOLORKEY set, only copy the pixels matching the
*       RGB values of the source colour key, ignoring alpha in the
*       comparison. 

BlitNtoNKey(), however, forgets to "ignore alpha in the comparison". The
documentation makes perfect sense, so I think it is the code that is faulty.

The attached patch corrects the code.

-Alex.
Comment 1 Ryan C. Gordon 2006-01-03 12:11:51 UTC
Created attachment 15 [details]
32bpp RGBA->RGB colorkey blit, no SDL_SRCALPHA patch


From: "Alex Volkov" <avcp-sdlmail@usa.net>
To: sdl@libsdl.org
Subject: [SDL] Re: BUG[?]: 32bpp RGBA->RGB colorkey blit, no SDL_SRCALPHA
Date: Fri, 11 Nov 2005 00:29:07 -0500

Updated patch attached. Never mind the previous one.

There are actually two problems addressed here. I was not sure if the
function was supposed to also mask off the alpha from the colorkey before
using it in comparisons, or if the colorkey was supposed to always be stored
w/o the alpha channel. Read more code -- alpha has to be masked off from the
colorkey, so there it is.

-Alex.
Comment 2 Ryan C. Gordon 2006-01-27 11:23:04 UTC
Setting Sam as "QA Contact" on all bugs (even resolved ones) so he'll definitely be in the loop to any further discussion here about SDL.

--ryan.

Comment 3 Sam Lantinga 2006-03-15 10:43:30 UTC
This patch is in CVS, thanks!