[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Wesnoth-cvs-commits] wesnoth/src sdl_utils.cpp sdl_utils.hpp
From: |
Guillaume Melquiond |
Subject: |
[Wesnoth-cvs-commits] wesnoth/src sdl_utils.cpp sdl_utils.hpp |
Date: |
Sat, 08 Jan 2005 18:23:11 -0500 |
CVSROOT: /cvsroot/wesnoth
Module name: wesnoth
Branch:
Changes by: Guillaume Melquiond <address@hidden> 05/01/08 23:06:27
Modified files:
src : sdl_utils.cpp sdl_utils.hpp
Log message:
Remove useless reference counting by using reference arguments. 9kB
size reduction on an optimized binary.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/sdl_utils.cpp.diff?tr1=1.69&tr2=1.70&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/sdl_utils.hpp.diff?tr1=1.49&tr2=1.50&r1=text&r2=text
Patches:
Index: wesnoth/src/sdl_utils.cpp
diff -u wesnoth/src/sdl_utils.cpp:1.69 wesnoth/src/sdl_utils.cpp:1.70
--- wesnoth/src/sdl_utils.cpp:1.69 Fri Jan 7 23:55:47 2005
+++ wesnoth/src/sdl_utils.cpp Sat Jan 8 23:06:27 2005
@@ -1,4 +1,4 @@
-/* $Id: sdl_utils.cpp,v 1.69 2005/01/07 23:55:47 silene Exp $ */
+/* $Id: sdl_utils.cpp,v 1.70 2005/01/08 23:06:27 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -70,7 +70,7 @@
}
-surface make_neutral_surface(surface surf)
+surface make_neutral_surface(surface const &surf)
{
if(surf == NULL) {
std::cerr << "null neutral surface...\n";
@@ -86,7 +86,7 @@
}
-surface create_optimized_surface(surface surf)
+surface create_optimized_surface(surface const &surf)
{
if(surf == NULL)
return NULL;
@@ -103,7 +103,7 @@
return result;
}
-surface scale_surface(surface surf, int w, int h)
+surface scale_surface(surface const &surf, int w, int h)
{
if(surf == NULL)
return NULL;
@@ -147,7 +147,7 @@
return create_optimized_surface(dst);
}
-surface scale_surface_blended(surface surf, int w, int h)
+surface scale_surface_blended(surface const &surf, int w, int h)
{
if(surf== NULL)
return NULL;
@@ -223,7 +223,7 @@
return create_optimized_surface(dst);
}
-surface adjust_surface_colour(surface surf, int r, int g, int b)
+surface adjust_surface_colour(surface const &surf, int r, int g, int b)
{
if(r == 0 && g == 0 && b == 0 || surf == NULL)
return create_optimized_surface(surf);
@@ -257,7 +257,7 @@
return create_optimized_surface(nsurf);
}
-surface greyscale_image(surface surf)
+surface greyscale_image(surface const &surf)
{
if(surf == NULL)
return NULL;
@@ -297,7 +297,7 @@
return create_optimized_surface(nsurf);
}
-surface brighten_image(surface surf, double amount)
+surface brighten_image(surface const &surf, double amount)
{
if(surf == NULL) {
return NULL;
@@ -332,7 +332,7 @@
return create_optimized_surface(nsurf);
}
-surface adjust_surface_alpha(surface surf, double amount)
+surface adjust_surface_alpha(surface const &surf, double amount)
{
if(surf== NULL) {
return NULL;
@@ -365,7 +365,7 @@
return create_optimized_surface(nsurf);
}
-surface adjust_surface_alpha_add(surface surf, int amount)
+surface adjust_surface_alpha_add(surface const &surf, int amount)
{
if(surf== NULL) {
return NULL;
@@ -399,7 +399,7 @@
}
// Applies a mask on a surface
-surface mask_surface(surface surf, surface mask)
+surface mask_surface(surface const &surf, surface const &mask)
{
if(surf == NULL) {
return NULL;
@@ -443,7 +443,7 @@
}
// Cross-fades a surface
-surface blur_surface(surface surf, int depth)
+surface blur_surface(surface const &surf, int depth)
{
if(surf == NULL) {
return NULL;
@@ -527,7 +527,7 @@
}
// Cuts a rectangle from a surface.
-surface cut_surface(surface surf, const SDL_Rect& r)
+surface cut_surface(surface const &surf, SDL_Rect const &r)
{
surface res = create_compatible_surface(surf, r.w, r.h);
@@ -557,7 +557,7 @@
return res;
}
-surface blend_surface(surface surf, double amount, Uint32 colour)
+surface blend_surface(surface const &surf, double amount, Uint32 colour)
{
if(surf== NULL) {
return NULL;
@@ -601,7 +601,7 @@
return create_optimized_surface(nsurf);
}
-surface flip_surface(surface surf)
+surface flip_surface(surface const &surf)
{
if(surf == NULL) {
return NULL;
@@ -630,7 +630,7 @@
return create_optimized_surface(nsurf);
}
-surface flop_surface(surface surf)
+surface flop_surface(surface const &surf)
{
if(surf == NULL) {
return NULL;
@@ -660,7 +660,7 @@
}
-surface create_compatible_surface(surface surf, int width, int height)
+surface create_compatible_surface(surface const &surf, int width, int height)
{
if(surf == NULL)
return NULL;
@@ -675,7 +675,7 @@
surf->format->Rmask,surf->format->Gmask,surf->format->Bmask,surf->format->Amask);
}
-void fill_rect_alpha(SDL_Rect& rect, Uint32 colour, Uint8 alpha, surface
target)
+void fill_rect_alpha(SDL_Rect &rect, Uint32 colour, Uint8 alpha, surface const
&target)
{
if(alpha == SDL_ALPHA_OPAQUE) {
SDL_FillRect(target,&rect,colour);
@@ -695,7 +695,7 @@
SDL_BlitSurface(tmp,NULL,target,&rect);
}
-surface get_surface_portion(surface src, SDL_Rect& area)
+surface get_surface_portion(surface const &src, SDL_Rect &area)
{
if(area.x >= src->w || area.y >= src->h) {
std::cerr << "illegal surface portion...\n";
@@ -741,7 +741,7 @@
}
-SDL_Rect get_non_transperant_portion(surface surf)
+SDL_Rect get_non_transperant_portion(surface const &surf)
{
SDL_Rect res = {0,0,0,0};
const surface nsurf(make_neutral_surface(surf));
Index: wesnoth/src/sdl_utils.hpp
diff -u wesnoth/src/sdl_utils.hpp:1.49 wesnoth/src/sdl_utils.hpp:1.50
--- wesnoth/src/sdl_utils.hpp:1.49 Mon Nov 1 18:06:36 2004
+++ wesnoth/src/sdl_utils.hpp Sat Jan 8 23:06:27 2005
@@ -1,4 +1,4 @@
-/* $Id: sdl_utils.hpp,v 1.49 2004/11/01 18:06:36 gruikya Exp $ */
+/* $Id: sdl_utils.hpp,v 1.50 2005/01/08 23:06:27 silene Exp $ */
/*
Copyright (C) 2003 by David White <address@hidden>
Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -95,27 +95,27 @@
bool operator<(const surface& a, const surface& b);
-surface make_neutral_surface(surface surf);
-surface create_optimized_surface(surface surface);
-surface scale_surface(surface surface, int w, int h);
-surface scale_surface_blended(surface surface, int w, int h);
-surface adjust_surface_colour(surface surface, int r, int g, int b);
-surface greyscale_image(surface surface);
-surface brighten_image(surface surface, double amount);
-surface get_surface_portion(surface src, SDL_Rect& rect);
-surface adjust_surface_alpha(surface surface, double amount);
-surface adjust_surface_alpha_add(surface surface, int amount);
-surface mask_surface(surface surf, surface mask);
-surface blur_surface(surface surf, int depth=1);
-surface cut_surface(surface surface, const SDL_Rect& r);
-surface blend_surface(surface surface, double amount, Uint32 colour);
-surface flip_surface(surface surface);
-surface flop_surface(surface surface);
-surface create_compatible_surface(surface surf, int width=-1, int height=-1);
+surface make_neutral_surface(surface const &surf);
+surface create_optimized_surface(surface const &surf);
+surface scale_surface(surface const &surf, int w, int h);
+surface scale_surface_blended(surface const &surf, int w, int h);
+surface adjust_surface_colour(surface const &surf, int r, int g, int b);
+surface greyscale_image(surface const &surf);
+surface brighten_image(surface const &surf, double amount);
+surface get_surface_portion(surface const &surf, SDL_Rect &rect);
+surface adjust_surface_alpha(surface const &surf, double amount);
+surface adjust_surface_alpha_add(surface const &surf, int amount);
+surface mask_surface(surface const &surf, surface const &mask);
+surface blur_surface(surface const &surf, int depth = 1);
+surface cut_surface(surface const &surf, SDL_Rect const &r);
+surface blend_surface(surface const &surf, double amount, Uint32 colour);
+surface flip_surface(surface const &surf);
+surface flop_surface(surface const &surf);
+surface create_compatible_surface(surface const &surf, int width = -1, int
height = -1);
-void fill_rect_alpha(SDL_Rect& rect, Uint32 colour, Uint8 alpha, surface
target);
+void fill_rect_alpha(SDL_Rect &rect, Uint32 colour, Uint8 alpha, surface const
&target);
-SDL_Rect get_non_transperant_portion(surface surf);
+SDL_Rect get_non_transperant_portion(surface const &surf);
bool operator==(const SDL_Rect& a, const SDL_Rect& b);
bool operator!=(const SDL_Rect& a, const SDL_Rect& b);
@@ -155,7 +155,7 @@
struct surface_lock
{
- surface_lock(surface surface) : surface_(surface), locked_(false)
+ surface_lock(surface const &surf) : surface_(surf), locked_(false)
{
if(SDL_MUSTLOCK(surface_)) {
const int res = SDL_LockSurface(surface_);
@@ -199,7 +199,7 @@
struct clip_rect_setter
{
- clip_rect_setter(surface surf, const SDL_Rect& r) : surface_(surf)
+ clip_rect_setter(surface const &surf, const SDL_Rect& r) :
surface_(surf)
{
SDL_GetClipRect(surface_,&rect);
SDL_SetClipRect(surface_,&r);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Wesnoth-cvs-commits] wesnoth/src sdl_utils.cpp sdl_utils.hpp,
Guillaume Melquiond <=