Author: ai0867
Date: Fri Sep 19 09:13:10 2008
New Revision: 29542

URL: http://svn.gna.org/viewcvs/wesnoth?rev=29542&view=rev
Log:
* Simplified + constified scale_background code.

Modified:
    trunk/src/intro.cpp

Modified: trunk/src/intro.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/intro.cpp?rev=29542&r1=29541&r2=29542&view=diff
==============================================================================
--- trunk/src/intro.cpp (original)
+++ trunk/src/intro.cpp Fri Sep 19 09:13:10 2008
@@ -111,7 +111,7 @@
 
        const std::string& background_name = part["background"];
        const bool show_title = utils::string_bool(part["show_title"]);
-       const bool scale_background = part["scale_background"].empty() ? true : 
utils::string_bool(part["scale_background"]);
+       const bool scale_background = 
utils::string_bool(part["scale_background"], true);
 
        surface background(NULL);
        if(background_name.empty() == false) {
@@ -127,9 +127,9 @@
                
background.assign(create_neutral_surface(video.getx(),video.gety()));
        }
 
-       double xscale = scale_background ? 1.0 * video.getx() / background->w : 
1.0;
-       double yscale = scale_background ? 1.0 * video.gety() / background->h : 
1.0;
-       double scale = std::min<double>(xscale,yscale);
+       const double xscale = 1.0 * video.getx() / background->w;
+       const double yscale = 1.0 * video.gety() / background->h;
+       const double scale = scale_background ? std::min<double>(xscale,yscale) 
: 1.0;
 
        background = scale_surface(background, 
static_cast<int>(background->w*scale), static_cast<int>(background->h*scale));
 


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to