In article <200010071517.RAA05395 at octans.nada.kth.se>, you say…
Should this read:
SDL_SetColorKey(convert,
-> surface_flags&(SDL_SRCCOLORKEY|SDL_RLEACCEL),
SDL_MapRGB(convert->format, keyR, keyG, keyB));
and
SDL_SetColorKey(surface,
-> surface_flags&(SDL_SRCCOLORKEY|SDL_RLEACCEL),
colorkey);
I don’t think so. It would help me more to know the exact input to
SDL_ConvertSurface(), including the format and flags of the image that
causes it to behave wrongly. A small program that exposes the possible
bug would be helpful as well.
{
// init video
SDL_Init(SDL_INIT_VIDEO);
SDL_InitSubSystem(SDL_INIT_VIDEO);
SDL_Surface *screen = SDL_SetVideoMode(800, 600, 16, SDL_HWSURFACE);
assert(screen);
SDL_Surface *img = IMG_Load("walk.png"); // load 8 bit png.
assert(img);
SDL_Rect dstRect = {0,0,img->w,img->h};
SDL_SetColorKey(img, SDL_SRCCOLORKEY|SDL_RLEACCEL, 8);
SDL_Surface *sdlSurface = SDL_DisplayFormat(img);
SDL_FreeSurface(img);
// show original image
SDL_BlitSurface(sdlSurface, NULL, screen, &dstRect);
SDL_Flip(screen);
// dup image
SDL_Surface *dupSurface = SDL_DisplayFormat(sdlSurface);
assert(dupSurface);
// show dup image
dstRect.x += (sdlSurface->w + 10); // show images side by side
SDL_BlitSurface(sdlSurface, NULL, screen, &dstRect);
SDL_Flip(screen);
// clean up
SDL_FreeSurface(dupSurface);
SDL_FreeSurface(sdlSurface);
SDL_Quit();
}
Just making random changes to the code is not productive
The changes I highlighted were not random but the result of 3 days of
grappling with the code and single stepping thousands of lines. My analysis
indicated a problem with the use of the RLE flags, I was hoping it would give
you a clue into what was happening.
the above fragment consistently reproduces my problem. i hope it helps
you nail this bastard bug which undermines your high performance RLE system.
good luck and please keep me informed as I have invested 40 hrs into this
bug and look forward to stuffing it and hanging it on my wall ASAP.
-dv