[SDL] Weird surface behavior

Ti Leggett leggett at eecs.tulane.edu
Wed Aug 22 06:21:01 PDT 2001

On 2001.08.22 04:07 =?ISO-8859-1?Q?Mattias Engdeg=E5rd?= wrote:
> Ti Leggett <leggett at eecs.tulane.edu> wrote:
> >color_map->pixels should remain constant since all I do is load the image
> once
> >and copy from it. surface->pixels should change only once (the first pass
> >through). After that it should remain the same since color_map shouldn't
> >change.
> >> Also in the main loop don't you need to lock a surface even to get read
> >> access to it (I am not sure)?
> No.
> 1. surface->pixels may return a different value each time the surface is
>    locked, so don't keep a pointer to pixels after unlocking
> 2. you must lock surfaces for any pixel access, reading or writing

Alrighty. Then that brings up another question. How big of performance hit is
locking and unlocking theses surfaces repeatedly?

Ti Leggett
leggett at eecs.tulane.edu

More information about the SDL mailing list