Author: mordante
Date: Tue Apr 29 21:46:55 2008
New Revision: 26237

URL: http://svn.gna.org/viewcvs/wesnoth?rev=26237&view=rev
Log:
Convert stretch_surface_*() also to have an optimize flag.

Modified:
    trunk/src/sdl_utils.cpp
    trunk/src/sdl_utils.hpp

Modified: trunk/src/sdl_utils.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/sdl_utils.cpp?rev=26237&r1=26236&r2=26237&view=diff
==============================================================================
--- trunk/src/sdl_utils.cpp (original)
+++ trunk/src/sdl_utils.cpp Tue Apr 29 21:46:55 2008
@@ -158,12 +158,15 @@
 //! This means only the first column of the original is used for the 
destination.
 //! @param surf              The source surface.
 //! @param w                 The width of the resulting surface.
+//! @param optimize          Should the return surface be RLE optimized.
 //!
 //! @return                  An optimized surface.
 //!                          returned. 
 //! @retval 0                Returned upon error.
-//! @retval surf             Returned if w == surf->w.
-surface stretch_surface_horizontal(const surface& surf, const unsigned w)
+//! @retval surf             Returned if w == surf->w, note this ignores the 
+//!                          optimize flag.
+surface stretch_surface_horizontal(
+               const surface& surf, const unsigned w, const bool optimize)
 {
        // Since SDL version 1.1.5 0 is transparent, before 255 was transparent.
        assert(SDL_ALPHA_TRANSPARENT==0);
@@ -205,7 +208,7 @@
                }
        }
 
-       return create_optimized_surface(dst);
+       return optimize ? create_optimized_surface(dst) : dst;
 }
 
 //! Streches a surface in the vertical direction.
@@ -215,12 +218,15 @@
 //! This means only the first row of the original is used for the destination.
 //! @param surf              The source surface.
 //! @param h                 The height of the resulting surface.
+//! @param optimize          Should the return surface be RLE optimized.
 //!
 //! @return                  An optimized surface.
 //!                          returned. 
 //! @retval 0                Returned upon error.
-//! @retval surf             Returned if h == surf->h.
-surface stretch_surface_vertical(const surface& surf, const unsigned h)
+//! @retval surf             Returned if h == surf->h, note this ignores the 
+//!                          optimize flag.
+surface stretch_surface_vertical(
+               const surface& surf, const unsigned h, const bool optimize)
 {
        // Since SDL version 1.1.5 0 is transparent, before 255 was transparent.
        assert(SDL_ALPHA_TRANSPARENT==0);
@@ -260,9 +266,8 @@
                }
        }
 
-       return create_optimized_surface(dst);
-}
-
+       return optimize ? create_optimized_surface(dst) : dst;
+}
 
 // NOTE: Don't pass this function 0 scaling arguments.
 surface scale_surface(surface const &surf, int w, int h, bool optimize)

Modified: trunk/src/sdl_utils.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/sdl_utils.hpp?rev=26237&r1=26236&r2=26237&view=diff
==============================================================================
--- trunk/src/sdl_utils.hpp (original)
+++ trunk/src/sdl_utils.hpp Tue Apr 29 21:46:55 2008
@@ -121,10 +121,12 @@
 surface create_optimized_surface(surface const &surf);
 
 //! Streches a surface in the horizontal direction.
-surface stretch_surface_horizontal(const surface& surf, const unsigned w);
+surface stretch_surface_horizontal(
+       const surface& surf, const unsigned w, const bool optimize = true);
 
 //! Streches a surface in the vertical direction.
-surface stretch_surface_vertical(const surface& surf, const unsigned h);
+surface stretch_surface_vertical(
+       const surface& surf, const unsigned h, const bool optimize = true);
 
 surface scale_surface(surface const &surf, int w, int h, bool optimize=true);
 surface scale_surface_blended(surface const &surf, int w, int h, bool 
optimize=true);


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

Reply via email to