From ae46a5b3b0ffbc8401a4bbfd71d04b06919c57d9 Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 6 Nov 2022 18:18:57 +0000 Subject: [PATCH] Simplify SDL gr_flip: nullptr implies copy all Per the header comments, passing nullptr for source or destination copies the entire region. Use that instead of explicitly requesting the entire region. This should be more efficient, since it bypasses the source rectangle clipping code that SDL would otherwise run. --- similar/arch/sdl/gr.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/similar/arch/sdl/gr.cpp b/similar/arch/sdl/gr.cpp index 6d2732174..ab16c93fa 100644 --- a/similar/arch/sdl/gr.cpp +++ b/similar/arch/sdl/gr.cpp @@ -43,13 +43,7 @@ static int gr_installed; void gr_flip() { - SDL_Rect src, dest; - - dest.x = src.x = dest.y = src.y = 0; - dest.w = src.w = canvas->w; - dest.h = src.h = canvas->h; - - SDL_BlitSurface(canvas, &src, screen, &dest); + SDL_BlitSurface(canvas, nullptr, screen, nullptr); SDL_Flip(screen); }