Sent this yesterday, but forgot to set my From. I wasn’t going to
resend it until the approval/rejection came through, but I don’t know
how long that typically takes on this list, so I’ll just risk a
double-post.***
Gah. Spent most of today tracking this down. Mostly because it was
compounding with lots of bugs in my own code; since I knew my code was
so buggy, I didn’t even think that something might be going wrong with
SDL, too.
First, the short:
Blitting from an R8G8B8A8 surface to an R4G4B4A4 (or R5G5B5A1) surface
was losing alpha completely: the whole surface would end up transparent.
Fixed this with the following:
— …/SDL_blit.h 2002-03-06 06:23:02.000000000 -0500
+++ SDL_blit.h 2002-10-19 22:19:40.000000000 -0400
@@ -330,7 +330,7 @@
pixel = ((r>>fmt->Rloss)<Rshift)|
((g>>fmt->Gloss)<Gshift)|
((b>>fmt->Bloss)<Bshift)| \
-
((a<<fmt->Aloss)<<fmt->Ashift); \
-
((a>>fmt->Aloss)<<fmt->Ashift); \
}
#define ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a)
{ \
I’m sure that may have been that way for a reason (though there’s no
comment explaining the exception), and that might break other blits,
but it fixed my problem.
Hmm. Now I need to implement resizing (with linear filtering, both
min and mag, preferably supporting wrapping the texture for the filter
as an option) and 32->16 bpp dithering. Is there any decent code out
there to handle these with SDL surfaces? This seems like a wheel.
–
Glenn Maynard