don't create_optimized_surface() for one-time-use

(speeds up sea battle a bit)
This commit is contained in:
Martin Renold 2007-02-25 18:04:30 +00:00
parent 09aaf0de3d
commit 77a1e5b48f
3 changed files with 9 additions and 5 deletions

View file

@ -1998,7 +1998,7 @@ void display::draw_unit(int x, int y, surface image,
//} else if(alpha != 1.0 && blendto != 0) {
// surf.assign(blend_surface(surf,1.0-alpha,blendto));
} else if(alpha != ftofxp(1.0)) {
surf = adjust_surface_alpha(surf,alpha);
surf = adjust_surface_alpha(surf,alpha,false);
}
if(surf == NULL) {
@ -2013,7 +2013,7 @@ void display::draw_unit(int x, int y, surface image,
video().blit_surface(x,y,surf,&srcrect,&clip_rect);
if(submerge_height != surf->h) {
surf.assign(adjust_surface_alpha(surf,ftofxp(0.2)));
surf.assign(adjust_surface_alpha(surf,ftofxp(0.2),false));
srcrect.y = submerge_height;
srcrect.h = surf->h-submerge_height;

View file

@ -567,7 +567,7 @@ surface brighten_image(surface const &surf, fixed_t amount)
return create_optimized_surface(nsurf);
}
surface adjust_surface_alpha(surface const &surf, fixed_t amount)
surface adjust_surface_alpha(surface const &surf, fixed_t amount, bool optimize)
{
if(surf== NULL) {
return NULL;
@ -601,7 +601,11 @@ surface adjust_surface_alpha(surface const &surf, fixed_t amount)
}
}
return create_optimized_surface(nsurf);
if (optimize) {
return create_optimized_surface(nsurf);
} else {
return nsurf;
}
}
surface adjust_surface_alpha_add(surface const &surf, int amount)

View file

@ -114,7 +114,7 @@ surface recolor_image(surface surf, const std::map<Uint32, Uint32>& map_rgb);
surface brighten_image(surface const &surf, fixed_t amount);
surface get_surface_portion(surface const &surf, SDL_Rect &rect);
surface adjust_surface_alpha(surface const &surf, fixed_t amount);
surface adjust_surface_alpha(surface const &surf, fixed_t amount, bool optimize=true);
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);