mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-02 06:29:34 +00:00
don't create_optimized_surface() for one-time-use
(speeds up sea battle a bit)
This commit is contained in:
parent
09aaf0de3d
commit
77a1e5b48f
@ -1998,7 +1998,7 @@ void display::draw_unit(int x, int y, surface image,
|
|||||||
//} else if(alpha != 1.0 && blendto != 0) {
|
//} else if(alpha != 1.0 && blendto != 0) {
|
||||||
// surf.assign(blend_surface(surf,1.0-alpha,blendto));
|
// surf.assign(blend_surface(surf,1.0-alpha,blendto));
|
||||||
} else if(alpha != ftofxp(1.0)) {
|
} else if(alpha != ftofxp(1.0)) {
|
||||||
surf = adjust_surface_alpha(surf,alpha);
|
surf = adjust_surface_alpha(surf,alpha,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(surf == NULL) {
|
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);
|
video().blit_surface(x,y,surf,&srcrect,&clip_rect);
|
||||||
|
|
||||||
if(submerge_height != surf->h) {
|
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.y = submerge_height;
|
||||||
srcrect.h = surf->h-submerge_height;
|
srcrect.h = surf->h-submerge_height;
|
||||||
|
@ -567,7 +567,7 @@ surface brighten_image(surface const &surf, fixed_t amount)
|
|||||||
return create_optimized_surface(nsurf);
|
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) {
|
if(surf== NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -601,7 +601,11 @@ surface adjust_surface_alpha(surface const &surf, fixed_t amount)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (optimize) {
|
||||||
return create_optimized_surface(nsurf);
|
return create_optimized_surface(nsurf);
|
||||||
|
} else {
|
||||||
|
return nsurf;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
surface adjust_surface_alpha_add(surface const &surf, int amount)
|
surface adjust_surface_alpha_add(surface const &surf, int amount)
|
||||||
|
@ -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 brighten_image(surface const &surf, fixed_t amount);
|
||||||
surface get_surface_portion(surface const &surf, SDL_Rect &rect);
|
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 adjust_surface_alpha_add(surface const &surf, int amount);
|
||||||
surface mask_surface(surface const &surf, surface const &mask);
|
surface mask_surface(surface const &surf, surface const &mask);
|
||||||
surface blur_surface(surface const &surf, int depth = 1);
|
surface blur_surface(surface const &surf, int depth = 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user