Questions regarding blitting

Hi!

Just a couple of questions:

  1. When copying pixels 1:1 from a surface onto another where the opacity, colormods and such do not matter,
    is the getpixel/putpixel method (described here:http://sdl.beuc.net/sdl.wiki/Pixel_Access) faster than SDL_BlitSurface?

  2. In SDL_surface.c of the SDL-2.0.2 source code, where SDL_LowerBlit can be found, there is this piece of code at line 514:

Code:
return (src->map->blit(src, srcrect, dst, dstrect));

Where in the code base can I find what map->blit(src, srcrect, dst, dstrect) does? I’m trying to understand how the blitting works better.

Hope you don’t mind helping this rookie out – thanks in advance! :slight_smile:

blit means “block transfer”. When pixel formats are the same and no processing (alpha/colorkey/etc) need to be done, src->map->blit points to a function that is basically a specialized memcpy. In this case, blitting will always be faster.
But otherwise, it might do all sorts of per-pixel calculation and set pixels individually. Blitting will probably still be faster.------------------------
Nate Fries

Ah, just what I needed to know!
Many thanks for your time. :slight_smile:

What were the answers?

R Manard wrote:

What were the answers?

Just to make sure; this is a question directed to Nathaniel right?

Well there’s a guy that asked question and the email list shows this but
someone answered it and it did not show up in the email list so I’m asking
what the answers wereOn Mar 23, 2014 3:34 PM, “thisismyroad” wrote:

R Manard wrote:

What were the answers?

Just to make sure; this is a question directed to Nathaniel right?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

R Manard wrote:

Well there’s a guy that asked question and the email list shows this but someone answered it and it did not show up in the email list so I’m asking what the answers were

Ah, so that’s what you meant. :slight_smile:
I’m using the SDL forums and the answer showed up just fine here so I was a bit confused by the question!
Anyway, this was the answer (thanks again for the help):> blit means “block transfer”. When pixel formats are the same and no processing (alpha/colorkey/etc) need to be done, src->map->blit points to a function that is basically a specialized memcpy. In this case, blitting will always be faster.

But otherwise, it might do all sorts of per-pixel calculation and set pixels individually. Blitting will probably still be faster.