Cleaned up unnecessary drawing calls
After testing, it seems these calls to raise_draw_event and display/game_display::draw() were unnecessary - or at least, became unnecessary at some point. One or two are definitely still needed, but removing these doesn't seem to cause anything to to glitch out. Likely explanation is anything that needs updating just gets updated either immediately or on the next play_slice loop.
This commit is contained in:
parent
b7efaadec4
commit
eba94b3e22
16 changed files with 0 additions and 66 deletions
|
@ -143,12 +143,10 @@ namespace
|
|||
animator.wait_for_end();
|
||||
animator.set_all_standing();
|
||||
resources::screen->invalidate(loc);
|
||||
resources::screen->draw();
|
||||
events::pump();
|
||||
}
|
||||
|
||||
resources::screen->invalidate_all();
|
||||
resources::screen->draw();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -964,7 +964,6 @@ void attack::fire_event(const std::string& n)
|
|||
|
||||
if(update_display_) {
|
||||
resources::screen->redraw_minimap();
|
||||
resources::screen->draw(true, true);
|
||||
}
|
||||
|
||||
fire_event("attack_end");
|
||||
|
@ -1473,7 +1472,6 @@ void attack::perform()
|
|||
resources::screen->invalidate_unit();
|
||||
resources::screen->invalidate(a_.loc_);
|
||||
resources::screen->invalidate(d_.loc_);
|
||||
resources::screen->draw(true, true);
|
||||
}
|
||||
|
||||
if(OOS_error_) {
|
||||
|
|
|
@ -620,8 +620,6 @@ namespace { // Private helpers for move_unit()
|
|||
if (ambush_string_.empty()) {
|
||||
ambush_string_ = _("Ambushed!");
|
||||
}
|
||||
// Update the display.
|
||||
resources::screen->draw();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1108,7 +1106,6 @@ namespace { // Private helpers for move_unit()
|
|||
|
||||
// Update the screen.
|
||||
resources::screen->redraw_minimap();
|
||||
resources::screen->draw();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1120,8 +1117,6 @@ namespace { // Private helpers for move_unit()
|
|||
// Alias some resources.
|
||||
game_display &disp = *resources::screen;
|
||||
|
||||
bool redraw = false;
|
||||
|
||||
// Multiple messages may be displayed simultaneously
|
||||
// this variable is used to keep them from overlapping
|
||||
std::string message_prefix = "";
|
||||
|
@ -1130,7 +1125,6 @@ namespace { // Private helpers for move_unit()
|
|||
if ( ambushed_ && show_ambush_alert_ ) {
|
||||
disp.announce(message_prefix + ambush_string_, font::BAD_COLOR);
|
||||
message_prefix += " \n";
|
||||
redraw = true;
|
||||
}
|
||||
|
||||
display::announce_options announce_options;
|
||||
|
@ -1141,7 +1135,6 @@ namespace { // Private helpers for move_unit()
|
|||
std::string teleport_string = _("Failed teleport! Exit not empty");
|
||||
disp.announce(message_prefix + teleport_string, font::BAD_COLOR, announce_options);
|
||||
message_prefix += " \n";
|
||||
redraw = true;
|
||||
}
|
||||
|
||||
// Sighted units feedback?
|
||||
|
@ -1171,7 +1164,6 @@ namespace { // Private helpers for move_unit()
|
|||
|
||||
disp.announce(message_prefix + message, msg_color, announce_options);
|
||||
message_prefix += " \n";
|
||||
redraw = true;
|
||||
}
|
||||
|
||||
// Suggest "continue move"?
|
||||
|
@ -1184,14 +1176,8 @@ namespace { // Private helpers for move_unit()
|
|||
std::string message = vgettext("(press $hotkey to keep moving)", symbols);
|
||||
disp.announce(message_prefix + message, font::NORMAL_COLOR, announce_options);
|
||||
message_prefix += " \n";
|
||||
redraw = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Update the screen.
|
||||
if (redraw) {
|
||||
disp.draw();
|
||||
}
|
||||
}
|
||||
|
||||
}//end anonymous namespace
|
||||
|
|
|
@ -376,7 +376,6 @@ void undo_list::undo()
|
|||
gui.invalidate_unit();
|
||||
gui.invalidate_game_status();
|
||||
gui.redraw_minimap();
|
||||
gui.draw();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -425,7 +424,6 @@ void undo_list::redo()
|
|||
gui.invalidate_unit();
|
||||
gui.invalidate_game_status();
|
||||
gui.redraw_minimap();
|
||||
gui.draw();
|
||||
}
|
||||
|
||||
|
||||
|
@ -484,14 +482,12 @@ bool undo_list::apply_shroud_changes() const
|
|||
|
||||
// Update the display before pumping events.
|
||||
clearer.invalidate_after_clear();
|
||||
disp.draw();
|
||||
|
||||
// Fire sighted events
|
||||
if ( std::get<0>(clearer.fire_events() )) {
|
||||
// Fix up the display in case WML changed stuff.
|
||||
clear_shroud(side_);
|
||||
disp.invalidate_unit();
|
||||
disp.draw();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -244,8 +244,6 @@ void unit_creator::post_create(const map_location &loc, const unit &new_unit, bo
|
|||
|
||||
if (animate) {
|
||||
unit_display::unit_recruited(loc);
|
||||
} else if (show) {
|
||||
resources::screen->draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,6 @@ editor_controller::editor_controller(const config &game_config)
|
|||
|
||||
gui().create_buttons();
|
||||
gui().redraw_everything();
|
||||
events::raise_draw_event();
|
||||
}
|
||||
|
||||
void editor_controller::init_gui()
|
||||
|
@ -710,11 +709,9 @@ bool editor_controller::execute_command(const hotkey::hotkey_command& cmd, int i
|
|||
return true;
|
||||
case HOTKEY_EDITOR_PALETTE_UPSCROLL:
|
||||
toolkit_->get_palette_manager()->scroll_up();
|
||||
gui_->draw(true,false);
|
||||
return true;
|
||||
case HOTKEY_EDITOR_PALETTE_DOWNSCROLL:
|
||||
toolkit_->get_palette_manager()->scroll_down();
|
||||
gui_->draw(true,false);
|
||||
return true;
|
||||
|
||||
case HOTKEY_QUIT_GAME:
|
||||
|
|
|
@ -141,7 +141,6 @@ void context_manager::refresh_all()
|
|||
get_map_context().set_needs_terrain_rebuild(false);
|
||||
gui_.create_buttons();
|
||||
gui_.invalidate_all();
|
||||
gui_.draw(false);
|
||||
get_map_context().clear_changed_locations();
|
||||
gui_.recalculate_minimap();
|
||||
}
|
||||
|
|
|
@ -123,7 +123,6 @@ void game_display::new_turn()
|
|||
}
|
||||
|
||||
invalidate_all();
|
||||
draw();
|
||||
|
||||
const int cur_ticks = SDL_GetTicks();
|
||||
const int wanted_ticks = starting_ticks + i*frame_time;
|
||||
|
@ -142,7 +141,6 @@ void game_display::new_turn()
|
|||
display::update_tod();
|
||||
|
||||
invalidate_all();
|
||||
draw();
|
||||
}
|
||||
|
||||
void game_display::select_hex(map_location hex)
|
||||
|
|
|
@ -963,7 +963,6 @@ void menu_handler::unit_hold_position(mouse_handler& mousehandler, int side_num)
|
|||
gui_->invalidate(mousehandler.get_selected_hex());
|
||||
|
||||
mousehandler.set_current_paths(pathfind::paths());
|
||||
gui_->draw();
|
||||
|
||||
if(un->hold_position()) {
|
||||
mousehandler.cycle_units(false);
|
||||
|
@ -979,7 +978,6 @@ void menu_handler::end_unit_turn(mouse_handler& mousehandler, int side_num)
|
|||
gui_->invalidate(mousehandler.get_selected_hex());
|
||||
|
||||
mousehandler.set_current_paths(pathfind::paths());
|
||||
gui_->draw();
|
||||
|
||||
if(un->user_end_turn()) {
|
||||
mousehandler.cycle_units(false);
|
||||
|
|
|
@ -936,7 +936,6 @@ void mouse_handler::save_whiteboard_attack(
|
|||
|
||||
// gui().highlight_hex(map_location());
|
||||
|
||||
gui().draw();
|
||||
gui().unhighlight_reach();
|
||||
gui().clear_attack_indicator();
|
||||
|
||||
|
@ -1064,7 +1063,6 @@ void mouse_handler::attack_enemy_(const map_location& att_loc, const map_locatio
|
|||
gui().highlight_hex(map_location());
|
||||
gui().clear_attack_indicator();
|
||||
gui().unhighlight_reach();
|
||||
gui().draw();
|
||||
|
||||
current_team().set_action_bonus_count(1 + current_team().action_bonus_count());
|
||||
///@todo change ToD to be location specific for the defender
|
||||
|
|
|
@ -282,8 +282,6 @@ void mouse_handler_base::right_mouse_up(int x, int y, const bool browse)
|
|||
return;
|
||||
}
|
||||
|
||||
gui().draw(); // redraw highlight (and maybe some more)
|
||||
|
||||
const theme::menu* const m = gui().get_theme().context_menu();
|
||||
if(m != nullptr) {
|
||||
show_menu_ = true;
|
||||
|
|
|
@ -993,7 +993,6 @@ void play_controller::update_gui_to_player(const int team_index, const bool obse
|
|||
gui_->set_team(team_index, observe);
|
||||
gui_->recalculate_minimap();
|
||||
gui_->invalidate_all();
|
||||
gui_->draw(true,true);
|
||||
}
|
||||
|
||||
void play_controller::do_autosave()
|
||||
|
@ -1090,7 +1089,6 @@ void play_controller::start_game()
|
|||
init_gui();
|
||||
LOG_NG << "first_time..." << (is_skipping_replay() ? "skipping" : "no skip") << "\n";
|
||||
|
||||
events::raise_draw_event();
|
||||
fire_start();
|
||||
if (is_regular_game_end()) {
|
||||
return;
|
||||
|
@ -1108,7 +1106,6 @@ void play_controller::start_game()
|
|||
else
|
||||
{
|
||||
init_gui();
|
||||
events::raise_draw_event();
|
||||
gamestate().gamedata_.set_phase(game_data::PLAY);
|
||||
gui_->recalculate_minimap();
|
||||
}
|
||||
|
@ -1167,7 +1164,6 @@ void play_controller::play_turn()
|
|||
whiteboard_manager_->on_gamestate_change();
|
||||
gui_->new_turn();
|
||||
gui_->invalidate_game_status();
|
||||
events::raise_draw_event();
|
||||
|
||||
LOG_NG << "turn: " << turn() << "\n";
|
||||
|
||||
|
|
|
@ -112,7 +112,6 @@ void playmp_controller::play_linger_turn()
|
|||
}
|
||||
}
|
||||
play_slice();
|
||||
gui_->draw();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,7 +199,6 @@ void playmp_controller::play_idle_loop()
|
|||
process_network_data();
|
||||
play_slice_catch();
|
||||
SDL_Delay(1);
|
||||
gui_->draw();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
|
@ -347,8 +345,6 @@ void playmp_controller::play_network_turn(){
|
|||
if (!network_processing_stopped_){
|
||||
turn_data_.send_data();
|
||||
}
|
||||
|
||||
gui_->draw();
|
||||
}
|
||||
|
||||
LOG_NG << "finished networked...\n";
|
||||
|
|
|
@ -147,9 +147,7 @@ void playsingle_controller::init_gui()
|
|||
}
|
||||
|
||||
update_locker lock_display(gui_->video(), is_skipping_replay());
|
||||
gui_->draw();
|
||||
get_hotkey_command_executor()->set_button_state();
|
||||
events::raise_draw_event();
|
||||
}
|
||||
|
||||
|
||||
|
@ -363,7 +361,6 @@ void playsingle_controller::play_idle_loop()
|
|||
{
|
||||
while(!should_return_to_play_side()) {
|
||||
play_slice_catch();
|
||||
gui_->draw();
|
||||
SDL_Delay(10);
|
||||
}
|
||||
}
|
||||
|
@ -474,7 +471,6 @@ void playsingle_controller::play_human_turn() {
|
|||
while(!should_return_to_play_side()) {
|
||||
check_objectives();
|
||||
play_slice_catch();
|
||||
gui_->draw();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -502,7 +498,6 @@ void playsingle_controller::linger()
|
|||
end_turn_ = END_TURN_NONE;
|
||||
while(end_turn_ == END_TURN_NONE) {
|
||||
play_slice();
|
||||
gui_->draw();
|
||||
}
|
||||
} catch(const savegame::load_game_exception &) {
|
||||
// Loading a new game is effectively a quit.
|
||||
|
@ -580,7 +575,6 @@ void playsingle_controller::play_ai_turn()
|
|||
gui_->invalidate_unit();
|
||||
gui_->invalidate_game_status();
|
||||
gui_->invalidate_all();
|
||||
gui_->draw();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -266,8 +266,6 @@ void replay_controller::update_gui()
|
|||
controller_.get_display().recalculate_minimap();
|
||||
controller_.get_display().redraw_minimap();
|
||||
controller_.get_display().invalidate_all();
|
||||
events::raise_draw_event();
|
||||
controller_.get_display().draw();
|
||||
}
|
||||
|
||||
void replay_controller::handle_generic_event(const std::string& name)
|
||||
|
|
|
@ -268,20 +268,6 @@ void unit_mover::start(unit_ptr u)
|
|||
// If it does not fit we might be able to do a better scroll later.
|
||||
disp_->scroll_to_tiles(path_, game_display::ONSCREEN, true, true, 0.0, false);
|
||||
}
|
||||
// We need to clear big invalidation before the move and have a smooth animation
|
||||
// (mainly black stripes and invalidation after canceling attack dialog).
|
||||
// Two draw calls are needed to also redraw the previously invalidated hexes.
|
||||
// We use update=false because we don't need delay here (no time wasted)
|
||||
// and no screen refresh (will be done by last 3rd draw() and it optimizes
|
||||
// the double blitting done by these invalidations).
|
||||
disp_->draw(false);
|
||||
disp_->draw(false);
|
||||
|
||||
// The last draw() was still slow, and its initial new_animation_frame() call
|
||||
// is now old, so we do another draw() to get a fresh one
|
||||
// TODO: replace that by a new_animation_frame() before starting anims
|
||||
// don't forget to change the previous draw(false) to true
|
||||
disp_->draw(true);
|
||||
|
||||
// extra immobile movement animation for take-off
|
||||
animator_.add_animation(temp_unit_ptr_.get(), "pre_movement", path_[0], path_[1]);
|
||||
|
|
Loading…
Add table
Reference in a new issue