Skip to content

Commit

Permalink
Removed draw() calls into the display class
Browse files Browse the repository at this point in the history
Not needed anymore since per-frame drawing is handled within said class.
  • Loading branch information
Vultraz committed Aug 12, 2017
1 parent e937e56 commit 9307697
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 37 deletions.
2 changes: 0 additions & 2 deletions src/actions/advancement.cpp
Expand Up @@ -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;
}
Expand Down
8 changes: 0 additions & 8 deletions src/actions/move.cpp
Expand Up @@ -620,8 +620,6 @@ namespace { // Private helpers for move_unit()
if (ambush_string_.empty()) {
ambush_string_ = _("Ambushed!");
}
// Update the display.
resources::screen->draw();
}


Expand Down Expand Up @@ -1108,7 +1106,6 @@ namespace { // Private helpers for move_unit()

// Update the screen.
resources::screen->redraw_minimap();
resources::screen->draw();
}


Expand Down Expand Up @@ -1184,11 +1181,6 @@ namespace { // Private helpers for move_unit()
redraw = true;
}
}

// Update the screen.
if (redraw) {
disp.draw();
}
}

}//end anonymous namespace
Expand Down
4 changes: 0 additions & 4 deletions src/actions/undo.cpp
Expand Up @@ -376,7 +376,6 @@ void undo_list::undo()
gui.invalidate_unit();
gui.invalidate_game_status();
gui.redraw_minimap();
gui.draw();
}
else
{
Expand Down Expand Up @@ -425,7 +424,6 @@ void undo_list::redo()
gui.invalidate_unit();
gui.invalidate_game_status();
gui.redraw_minimap();
gui.draw();
}


Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions src/actions/unit_creator.cpp
Expand Up @@ -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();
}
}
}
3 changes: 2 additions & 1 deletion src/controller_base.cpp
Expand Up @@ -308,7 +308,8 @@ void controller_base::play_slice(bool is_delay_enabled)
scrolling_ = true;
}

// be nice when window is not visible // NOTE should be handled by display instead, to only disable drawing
// be nice when window is not visible
// NOTE should be handled by display instead, to only disable drawing
sdl::window* window = CVideo::get_singleton().get_window();
if(window != nullptr && is_delay_enabled && (window->get_flags() & SDL_WINDOW_SHOWN) == 0) {
CVideo::delay(200);
Expand Down
1 change: 0 additions & 1 deletion src/editor/action/action_item.cpp
Expand Up @@ -112,7 +112,6 @@ void editor_action_item_replace::perform_without_undo(map_context& /*mc*/) const
//
////TODO check if that is useful
//// resources::screen->invalidate_item_after_move(loc_, new_loc_);
//// resources::screen->draw();
}


Expand Down
1 change: 0 additions & 1 deletion src/editor/action/action_unit.cpp
Expand Up @@ -113,7 +113,6 @@ void editor_action_unit_replace::perform_without_undo(map_context& mc) const

//TODO check if that is useful
// resources::screen->invalidate_unit_after_move(loc_, new_loc_);
// resources::screen->draw();
}


Expand Down
2 changes: 0 additions & 2 deletions src/menu_events.cpp
Expand Up @@ -950,7 +950,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);
Expand All @@ -966,7 +965,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);
Expand Down
2 changes: 0 additions & 2 deletions src/mouse_events.cpp
Expand Up @@ -873,7 +873,6 @@ void mouse_handler::save_whiteboard_attack(const map_location& attacker_loc, con

// gui().highlight_hex(map_location());

gui().draw();
gui().unhighlight_reach();
gui().clear_attack_indicator();

Expand Down Expand Up @@ -1004,7 +1003,6 @@ void mouse_handler::attack_enemy_(const map_location& att_loc
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
Expand Down
2 changes: 0 additions & 2 deletions src/mouse_handler_base.cpp
Expand Up @@ -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;
Expand Down
6 changes: 0 additions & 6 deletions src/playmp_controller.cpp
Expand Up @@ -113,7 +113,6 @@ void playmp_controller::play_linger_turn()
}
}
play_slice();
gui_->draw();
}
}

Expand Down Expand Up @@ -185,8 +184,6 @@ void playmp_controller::play_human_turn()
throw;
}
turn_data_.send_data();

gui_->draw();
}
}

Expand All @@ -203,7 +200,6 @@ void playmp_controller::play_idle_loop()
process_network_data();
play_slice_catch();
SDL_Delay(1);
gui_->draw();
}
catch(...)
{
Expand Down Expand Up @@ -350,8 +346,6 @@ void playmp_controller::play_network_turn(){
if (!network_processing_stopped_){
turn_data_.send_data();
}

gui_->draw();
}

LOG_NG << "finished networked...\n";
Expand Down
5 changes: 0 additions & 5 deletions src/playsingle_controller.cpp
Expand Up @@ -143,7 +143,6 @@ 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();
}
Expand Down Expand Up @@ -364,7 +363,6 @@ void playsingle_controller::play_idle_loop()
{
while(!should_return_to_play_side()) {
play_slice_catch();
gui_->draw();
SDL_Delay(10);
}
}
Expand Down Expand Up @@ -475,7 +473,6 @@ void playsingle_controller::play_human_turn() {
while(!should_return_to_play_side()) {
check_objectives();
play_slice_catch();
gui_->draw();
}

}
Expand Down Expand Up @@ -503,7 +500,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.
Expand Down Expand Up @@ -581,7 +577,6 @@ void playsingle_controller::play_ai_turn()
gui_->invalidate_unit();
gui_->invalidate_game_status();
gui_->invalidate_all();
gui_->draw();
}


Expand Down
1 change: 0 additions & 1 deletion src/scripting/game_lua_kernel.cpp
Expand Up @@ -3767,7 +3767,6 @@ int game_lua_kernel::intf_teleport(lua_State *L)
}

game_display_->invalidate_unit_after_move(src_loc, vacant_dst);
game_display_->draw();

// Sighted events.
clearer.fire_events();
Expand Down

0 comments on commit 9307697

Please sign in to comment.