[SDL] Does SDL clip surfaces on blitting?

Solra Bizna sbizna at tejat.net
Sun Dec 30 17:38:57 PST 2007

On Dec 30, 2007 12:07 AM, Jonathan Greig <redteam316 at gmail.com> wrote:
> Yes, it does only display the size of your "screen" as James said. I am a
> bit interested in this myself from a performance standpoint, as a bit of
> code I have written in the past loads a large image into a surface. Does SDL
> spend time clipping the pixel data before blitting? I.E. is the unused
> portion of the image actually causing any performance impact as opposed to
> clipping the image manually before blitting?
SDL_BlitSurface basically just does clipping on the rectangles in
question and then hands them off to SDL_LowerBlit. The clipping is
done to the rectangles, so unblitted portions won't affect performance
(barring the influence of caches).
If you've written your own clipping code, or know for a fact that no
clipping needs to be done, you can obtain an insignificant performance
boost by using SDL_LowerBlit. Usually, you want clipping; the extra
performance will only matter if you're blitting tons of really tiny

More information about the SDL mailing list