wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth src/video.cpp ./changelog


From: David White
Subject: [Wesnoth-cvs-commits] wesnoth src/video.cpp ./changelog
Date: Thu, 02 Jun 2005 19:12:59 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     David White <address@hidden>    05/06/02 23:12:59

Modified files:
        src            : video.cpp 
        .              : changelog 

Log message:
        sped up framerate when scrolling the map

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/video.cpp.diff?tr1=1.64&tr2=1.65&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/changelog.diff?tr1=1.705&tr2=1.706&r1=text&r2=text

Patches:
Index: wesnoth/changelog
diff -u wesnoth/changelog:1.705 wesnoth/changelog:1.706
--- wesnoth/changelog:1.705     Thu Jun  2 23:10:55 2005
+++ wesnoth/changelog   Thu Jun  2 23:12:59 2005
@@ -1,5 +1,6 @@
 CVS HEAD:
  * user interface improvements:
+   * sped up frame rate when scrolling the map
    * made connecting to a server show a dialog that allows the user to cancel 
it rather than blocking
    * added hotkey for cycle to previous unit (shift-N) (part of #10703)
    * added hotkey for hold position (shift-space) (patch 3994)
Index: wesnoth/src/video.cpp
diff -u wesnoth/src/video.cpp:1.64 wesnoth/src/video.cpp:1.65
--- wesnoth/src/video.cpp:1.64  Wed Apr 13 18:47:20 2005
+++ wesnoth/src/video.cpp       Thu Jun  2 23:12:59 2005
@@ -1,4 +1,4 @@
-/* $Id: video.cpp,v 1.64 2005/04/13 18:47:20 gruikya Exp $ */
+/* $Id: video.cpp,v 1.65 2005/06/02 23:12:59 Sirp Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -269,7 +269,7 @@
                return 0;
 
        fullScreen = (flags & FULL_SCREEN) != 0;
-       frameBuffer = SDL_SetVideoMode( x, y, bits_per_pixel, flags );
+       frameBuffer = SDL_SetVideoMode( x, y, 0, flags );
 
        if( frameBuffer != NULL ) {
                image::set_pixel_format(frameBuffer->format);
@@ -333,8 +333,19 @@
 
        if(update_all) {
                ::SDL_Flip(frameBuffer);
-       } else if(update_rects.empty() == false) {
-               
SDL_UpdateRects(frameBuffer,update_rects.size(),&update_rects[0]);
+       } else if(update_rects.empty() == false) {
+               size_t sum = 0;
+               for(size_t n = 0; n != update_rects.size(); ++n) {
+                       sum += update_rects[n].w*update_rects[n].h;
+               }
+
+               const int t = SDL_GetTicks();
+               const size_t redraw_whole_screen_threshold = 80;
+               if(sum > ((getx()*gety())*redraw_whole_screen_threshold)/100) {
+                       ::SDL_Flip(frameBuffer);
+               } else {
+                       
SDL_UpdateRects(frameBuffer,update_rects.size(),&update_rects[0]);
+               }
        }
 
        clear_updates();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]