Color Key problem w/ 32 bpp

Hello. I have an issue getting color key blitting to work when I
convert a 16 bpp surface to 32 bpp. Example code:

// first, we need to create the surface from raw 16 bpp.
SDL_PixelFormat *video_fmt = SDL_GetVideoSurface()->format;
surf = SDL_CreateRGBSurfaceFrom(data, width, height, 16, width<<1,
				0xf800, 0x7e0, 0x1f, 0x0);
if(!surf) { return NULL; }

tmp = SDL_ConvertSurface(surf, video_fmt, SDL_HWSURFACE);
SDL_FreeSurface(surf);

if(!tmp) { return NULL; }
surf = tmp;

// Small test I added to see if this worked. It did. more on
// this later.
SDL_Rect r = { 0,0,1,1 };
SDL_FillRect(surf, &r, SDL_MapRGB(surf->format, 255, 0, 255));

// set the transparent pixel value
SDL_SetColorKey(surf, SDL_SRCCOLORKEY|SDL_RLEACCEL, SDL_MapRGB(surf->format, 255, 0, 255));

Ok, so in the above example the one pixel in the top left corner
is transparent. The rest of the 0xff00ff pixels in the surface is
not. I saved the raw pixel data to file to try to figure out why and
behold what I got:

SDL_FillRect area: 0xff00ff00
Other pixels: 0xff00ffff

The transparent color in the 16 bpp raw data is 0xf81f and it’s
converted correctly.

So the problem is that this per-pixel alpha-less surface has a
per-pixel alpha value which messes up color key stuff. I suppose one
possible fix would be to manually set every 4th byte to 0 but that’s
ugly. So is the problem in SDL_ConvertSurface setting the alpha pixel
to 0xff rather than 0x00? Or is the problem that SDL_FillRect and
colorkey blitting for non-alpha 32 surfaces expects the alpha channel
to be set to 0? I don’t know what the issue is, I just know it’s
broken and that a fix could be kludged in. Should note that the RGB
masks are 0xff0000, 0xff00 and 0xff and a mask is 0.

Thanks.–
[ Below is a random fortune, which is unrelated to the above message. ]
If you are not for yourself, who will be for you?
If you are for yourself, then what are you?
If not now, when?