Mail Archives: djgpp/1997/01/04/07:11:52
Alex Demko writes:
>What would be faster:
>
> * To use blit() 1-3 times (enough to fill the screen)
> or
> * to use draw_rle_sprite() to fill the screen with 20x20
> sprites
I'd guess the blit would be quite a bit faster. The big difference
between the two is that draw_rle_sprite() supports transparent pixels,
and blit() doesn't. This means the blit can use a very simple (and
therefore fast) inner loop, copying four pixels at a time with 32 bit
instructions. The RLE sprite drawer can do some of this sort of
optimisation, because the pixels are grouped in runs (that's why it is
faster than drawing regular, non-RLE sprites), but it has to handle
varying run lengths and so there is a lot more overhead. Also, clipping
RLE sprites is very complicated and not very fast, wheras clipping a
simple rectangle blit is trivial.
/*
* Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
* Ghoti: 'gh' as in 'enough', 'o' as in 'women', and 'ti' as in 'nation'.
*/
- Raw text -