Author: cazfi
Date: Thu Feb 12 22:06:43 2015
New Revision: 28118

URL: http://svn.gna.org/viewcvs/freeciv?rev=28118&view=rev
Log:
Added option to force SW Renderer to use in sdl2-client

See patch #5802

Modified:
    branches/S2_6/client/gui-sdl2/graphics.c
    branches/S2_6/client/gui-sdl2/mapview.c
    branches/S2_6/client/options.c
    branches/S2_6/client/options.h

Modified: branches/S2_6/client/gui-sdl2/graphics.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl2/graphics.c?rev=28118&r1=28117&r2=28118&view=diff
==============================================================================
--- branches/S2_6/client/gui-sdl2/graphics.c    (original)
+++ branches/S2_6/client/gui-sdl2/graphics.c    Thu Feb 12 22:06:43 2015
@@ -615,6 +615,8 @@
 **************************************************************************/
 int set_video_mode(int iWidth, int iHeight, int iFlags)
 {
+  unsigned int flags;
+
   Main.screen = SDL_CreateWindow(_("SDL2 Client for Freeciv"),
                                  SDL_WINDOWPOS_UNDEFINED,
                                  SDL_WINDOWPOS_UNDEFINED,
@@ -637,7 +639,13 @@
 #endif
 );
 
-  Main.renderer = SDL_CreateRenderer(Main.screen, -1, 0);
+  if (options.gui_sdl2_swrenderer) {
+    flags = SDL_RENDERER_SOFTWARE;
+  } else {
+    flags = 0;
+  }
+
+  Main.renderer = SDL_CreateRenderer(Main.screen, -1, flags);
 
   Main.maintext = SDL_CreateTexture(Main.renderer,
                                     SDL_PIXELFORMAT_ARGB8888,

Modified: branches/S2_6/client/gui-sdl2/mapview.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl2/mapview.c?rev=28118&r1=28117&r2=28118&view=diff
==============================================================================
--- branches/S2_6/client/gui-sdl2/mapview.c     (original)
+++ branches/S2_6/client/gui-sdl2/mapview.c     Thu Feb 12 22:06:43 2015
@@ -240,7 +240,7 @@
 
     draw_mouse_cursor();
 
-    /* flush main buffer to framebuffer */
+    /* Render to screen */
     update_main_screen();
   } else {
     static int i;
@@ -276,7 +276,7 @@
 
     draw_mouse_cursor();
 
-    /* flush main buffer to framebuffer */
+    /* Render to screen */
     update_main_screen();
 #if 0
     SDL_UpdateRects(Main.screen, Main.rects_count, Main.rects);

Modified: branches/S2_6/client/options.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/options.c?rev=28118&r1=28117&r2=28118&view=diff
==============================================================================
--- branches/S2_6/client/options.c      (original)
+++ branches/S2_6/client/options.c      Thu Feb 12 22:06:43 2015
@@ -253,6 +253,7 @@
   .gui_sdl2_default_theme_name = FC_SDL2_DEFAULT_THEME_NAME,
   .gui_sdl2_fullscreen = FALSE,
   .gui_sdl2_screen = VIDEO_MODE(640, 480),
+  .gui_sdl2_swrenderer = FALSE,
   .gui_sdl2_do_cursor_animation = TRUE,
   .gui_sdl2_use_color_cursors = TRUE,
 
@@ -2684,6 +2685,10 @@
                    N_("This option controls the resolution of the "
                       "selected screen."),
                    COC_INTERFACE, GUI_SDL2, 640, 480, NULL),
+  GEN_BOOL_OPTION(gui_sdl2_swrenderer, N_("Use software rendering"),
+                  N_("Usually hardware rendering is used when possible. "
+                     "With this option set, software rendering is always 
used."),
+                  COC_GRAPHICS, GUI_SDL2, FALSE, NULL),
   GEN_BOOL_OPTION(gui_sdl2_do_cursor_animation, N_("Do cursor animation"),
                   N_("If this option is disabled, the cursor will "
                      "always be displayed as static."),

Modified: branches/S2_6/client/options.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/options.h?rev=28118&r1=28117&r2=28118&view=diff
==============================================================================
--- branches/S2_6/client/options.h      (original)
+++ branches/S2_6/client/options.h      Thu Feb 12 22:06:43 2015
@@ -266,6 +266,7 @@
   char gui_sdl2_default_theme_name[512];
   bool gui_sdl2_fullscreen;
   struct video_mode gui_sdl2_screen;
+  bool gui_sdl2_swrenderer;
   bool gui_sdl2_do_cursor_animation;
   bool gui_sdl2_use_color_cursors;
 


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

Reply via email to