Call me a bean counter, but doesn’t this:
pic1 = SDL_DisplayFormatAlpha(pic1);
alocate space for a new SDL_Surface, and leave the old pic1 surface in
limbo?
Careful, careful!
( If this is not the case, let me know! I’m wasting variable names : )
Brent Schartung wrote:
Call me a bean counter, but doesn’t this:
pic1 = SDL_DisplayFormatAlpha(pic1);
alocate space for a new SDL_Surface, and leave the old pic1 surface in
limbo?
Yes, and it’s a common mistake. Don’t
Careful, careful!
( If this is not the case, let me know! I’m wasting variable names : )
Assigning to a temporary variable and freeing the old surface is the
right thing to do.
-John
“John R. Hall” wrote:
Brent Schartung wrote:
Call me a bean counter, but doesn’t this:
pic1 = SDL_DisplayFormatAlpha(pic1);
alocate space for a new SDL_Surface, and leave the old pic1 surface in
limbo?
Yes, and it’s a common mistake. Don’t
Careful, careful!
( If this is not the case, let me know! I’m wasting variable names : )
Assigning to a temporary variable and freeing the old surface is the
right thing to do.
Anyone using this function can write a really simple wrapper:
func FormatAlpha (pic)
tpic = SDL_DisplayFormatAlpha (pic)
DeletePic (pic)
return tpic
end
if they really wanted to. And yes, that’s really crappy psuedo code, but I’m
in a hurry. ~,^>
-John