Display: avoid temp vectors when rendering partial fog/shround images on hex
This commit is contained in:
parent
eeece5e3c7
commit
2ba020a746
2 changed files with 6 additions and 16 deletions
|
@ -903,7 +903,7 @@ static const std::string& get_direction(size_t n)
|
|||
return dirs[n >= dirs.size() ? 0 : n];
|
||||
}
|
||||
|
||||
std::vector<texture> display::get_fog_shroud_images(const map_location& loc, image::TYPE /*image_type*/)
|
||||
void display::draw_fog_shroud_transition_images(const map_location& loc, image::TYPE /*image_type*/)
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
|
||||
|
@ -979,18 +979,10 @@ std::vector<texture> display::get_fog_shroud_images(const map_location& loc, ima
|
|||
}
|
||||
}
|
||||
|
||||
// now get the surfaces
|
||||
std::vector<texture> res;
|
||||
res.reserve(names.size());
|
||||
|
||||
// Now render the images
|
||||
for(std::string& name : names) {
|
||||
texture tex(image::get_texture(name)); // TODO: image_type
|
||||
if(tex) {
|
||||
res.push_back(std::move(tex));
|
||||
}
|
||||
render_scaled_to_zoom(image::get_texture(name), loc); // TODO: image_type
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void display::toggle_benchmark()
|
||||
|
@ -2601,9 +2593,7 @@ void display::draw_gamemap()
|
|||
|
||||
// Transitions to main hexes.
|
||||
if(!is_shrouded) {
|
||||
for(const texture& t : get_fog_shroud_images(loc, image_type)) {
|
||||
render_scaled_to_zoom(t, loc);
|
||||
}
|
||||
draw_fog_shroud_transition_images(loc, image_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -973,8 +973,8 @@ protected:
|
|||
*/
|
||||
virtual const SDL_Rect& get_clip_rect();
|
||||
|
||||
/** Gets the appropriate fog or shroud images for a specific hex. */
|
||||
std::vector<texture> get_fog_shroud_images(const map_location& loc, image::TYPE image_type);
|
||||
/** Draw the appropriate fog or shroud transition images for a specific hex. */
|
||||
void draw_fog_shroud_transition_images(const map_location& loc, image::TYPE image_type);
|
||||
|
||||
void draw_image_for_report(surface& img, SDL_Rect& rect);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue