From 136a8d9d444560f71fca89f27475cfeaffa19cf3 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 12 Jun 2015 12:16:02 +0200 Subject: sdl2: stop flickering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Optimizing updates by copying the dirty rectangle only do not work because of double-buffering. Signed-off-by: Gerd Hoffmann Reviewed-by: Marc-André Lureau Reviewed-by: Max Reitz --- ui/sdl2-2d.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ui/sdl2-2d.c b/ui/sdl2-2d.c index d0b340f956..191ee3b52d 100644 --- a/ui/sdl2-2d.c +++ b/ui/sdl2-2d.c @@ -45,10 +45,23 @@ void sdl2_2d_update(DisplayChangeListener *dcl, return; } + /* + * SDL2 seems to do some double-buffering, and trying to only + * update the changed areas results in only one of the two buffers + * being updated. Which flickers alot. So lets not try to be + * clever do a full update every time ... + */ +#if 0 rect.x = x; rect.y = y; rect.w = w; rect.h = h; +#else + rect.x = 0; + rect.y = 0; + rect.w = surface_width(surf); + rect.h = surface_height(surf); +#endif SDL_UpdateTexture(scon->texture, NULL, surface_data(surf), surface_stride(surf)); -- cgit v1.2.1