Sdl_rleaccel

The documentation for SDL_SetColorKey() says that, if SDL_RLEACCEL is set,
‘The surface will actually be encoded for RLE acceleration the first time
SDL_BlitSurface or SDL_DisplayFormat is called on the surface.’ Does this
mean an encoded copy of the surface is stored in some private buffer
somewhere? Or does the ‘pixels’ field of SDL_Surface get reencoded,
so that it need to be treated specially after RLE encoding?

Ron Steinke

Hi,

a long-winded description is here:
http://www.libsdl.org/pipermail/sdl/2003-December/058388.html

In short:
The ‘rle_surface->pixels’ field gets set to NULL and the RLE surface data is
stored privately. To access the raw pixel data again:

SDL_LockSurface(rle_surface);
// rle_surface->pixels valid inside here
SDL_UnlockSurface(rle_surface);
// rle_surface->pixels no longer valid (set to NULL to expose bugs cleanly)

Modifying an existing RLE surface costs you a decode (when locking) and a
re-encode (when unlocking). The benefit is faster rendering and if the RLE
surfaces in question are being pre-rendered (instead of being modified
frequently) the trade-off is a good one,

cheers,
John.On Sunday 14 December 2003 7:33 pm, rsteinke at w-link.net wrote:

The documentation for SDL_SetColorKey() says that, if SDL_RLEACCEL is set,
‘The surface will actually be encoded for RLE acceleration the first time
SDL_BlitSurface or SDL_DisplayFormat is called on the surface.’ Does this
mean an encoded copy of the surface is stored in some private buffer
somewhere? Or does the ‘pixels’ field of SDL_Surface get reencoded,
so that it need to be treated specially after RLE encoding?

Ron Steinke


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl