[SDL] Improving SDL'c RLE handling

Gunnar von Boehn gunnar at greyhound-data.com
Fri Apr 7 03:25:40 PDT 2006


Hi,

I have a small proposal for the way SDL handles RLE optimized surfaces.
The way SDL blittes RLE sprites that are partly clipped is not fully 
optimized yet.

When SDL copies sprites which are partly above the screen then SDL
currently needs to parse the Sprite data to find the first visible row.
Example: When we have a sprite of 100x100 pixel of which only the last 
10 rows are on the screen, then SDL still has still to read all 10,000 
pixel to find the visible 1,000 pixel.

My proposal is to not use the current magic (0,0) words to mark a 
beginning a RLE row but instead to use a list of length-words (type 
uint32) which point to the beginning of each row in the sprite data.
So a clipped sprite would only need to fetch one long to know where the 
sprite data of the first visible row starts. This will speed up top 
screen clipped sprites noticeable. A sprite will only take the time for 
blitting the visible content and not need to read the whole sprite like 
before.


I hope you will find this idea usefull.

Cheers
Gunnar




More information about the SDL mailing list