- if (SDL_MUSTLOCK(surface))
- while (SDL_LockSurface(surface) < 0)
- SDL_Delay(10);
-
- memcpy(surface->pixels, backbuffer, tom_width * tom_height * 2);
-
- if (SDL_MUSTLOCK(surface))
- SDL_UnlockSurface(surface);
-
- SDL_Rect srcrect, dstrect;
- srcrect.x = srcrect.y = 0, srcrect.w = surface->w, srcrect.h = surface->h;
- dstrect.x = dstrect.y = 0, dstrect.w = surface->w, dstrect.h = surface->h;
- SDL_BlitSurface(surface, &srcrect, mainSurface, &dstrect);
- SDL_Flip(mainSurface);