Skip to content

Instantly share code, notes, and snippets.

@nikolas
Last active March 2, 2019 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikolas/1bb8c675209d2296a23cc1a395a32a0d to your computer and use it in GitHub Desktop.
Save nikolas/1bb8c675209d2296a23cc1a395a32a0d to your computer and use it in GitHub Desktop.
static void DrawSurfaceToScreen()
{
int n = _num_dirty_rects;
if (n == 0) return;
_num_dirty_rects = 0;
if (n > MAX_DIRTY_RECTS) {
if (_sdl_screen != _sdl_realscreen) {
SDL_CALL SDL_BlitSurface(_sdl_screen, NULL, _sdl_realscreen, NULL);
}
SDL_CALL SDL_UpdateRect(_sdl_realscreen, 0, 0, 0, 0);
} else {
if (_sdl_screen != _sdl_realscreen) {
for (int i = 0; i < n; i++) {
SDL_CALL SDL_BlitSurface(_sdl_screen, &_dirty_rects[i], _sdl_realscreen, &_dirty_rects[i]);
}
}
SDL_CALL SDL_UpdateRects(_sdl_realscreen, n, _dirty_rects);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment