Author: cazfi
Date: Sun Mar  1 02:04:45 2015
New Revision: 28332

URL: http://svn.gna.org/viewcvs/freeciv?rev=28332&view=rev
Log:
Guard sdl2-client rendering from main surface to screen with dirtyness 
indication

See patch #5867

Modified:
    trunk/client/gui-sdl2/graphics.c

Modified: trunk/client/gui-sdl2/graphics.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/graphics.c?rev=28332&r1=28331&r2=28332&view=diff
==============================================================================
--- trunk/client/gui-sdl2/graphics.c    (original)
+++ trunk/client/gui-sdl2/graphics.c    Sun Mar  1 02:04:45 2015
@@ -56,6 +56,8 @@
 
 static SDL_Surface *main_surface;
 
+static bool render_dirty = TRUE;
+
 /**************************************************************************
   Allocate new gui_layer.
 **************************************************************************/
@@ -206,6 +208,7 @@
 int screen_blit(SDL_Surface *src, SDL_Rect *srcrect, SDL_Rect *dstrect,
                 unsigned char alpha_mod)
 {
+  render_dirty = TRUE;
   return alphablit(src, srcrect, main_surface, dstrect, alpha_mod);
 }
 
@@ -735,11 +738,15 @@
 **************************************************************************/
 void update_main_screen(void)
 {
-  SDL_UpdateTexture(Main.maintext, NULL,
-                    main_surface->pixels, main_surface->pitch);
-  SDL_RenderClear(Main.renderer);
-  SDL_RenderCopy(Main.renderer, Main.maintext, NULL, NULL);
-  SDL_RenderPresent(Main.renderer);
+  if (render_dirty) {
+    SDL_UpdateTexture(Main.maintext, NULL,
+                      main_surface->pixels, main_surface->pitch);
+    SDL_RenderClear(Main.renderer);
+    SDL_RenderCopy(Main.renderer, Main.maintext, NULL, NULL);
+    SDL_RenderPresent(Main.renderer);
+
+    render_dirty = FALSE;
+  }
 }
 
 /**************************************************************************


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to