Display: removed old drawing code and external draw calls

This commit is contained in:
Charles Dang 2017-07-05 22:43:09 +11:00
parent 9850e47720
commit a86ac0675f
6 changed files with 13 additions and 96 deletions

View file

@ -325,8 +325,8 @@ bool shroud_clearer::clear_unit(const map_location &view_loc, team &view_team,
move_unit_spectator * spectator, bool instant)
{
// Give animations a chance to progress; see bug #20324.
if ( !instant && display::get_singleton() )
display::get_singleton()->draw(true);
// TODO: ^ is this something we need to worry about now that external draw calls are removed?
// vultraz, 7/5/2017
bool cleared_something = false;
// Dummy variables to make some logic simpler.
@ -340,15 +340,15 @@ bool shroud_clearer::clear_unit(const map_location &view_loc, team &view_team,
if ( view_team_ != &view_team ) {
calculate_jamming(&view_team);
// Give animations a chance to progress; see bug #20324.
if ( !instant && display::get_singleton() )
display::get_singleton()->draw(true);
// TODO: ^ is this something we need to worry about now that external draw calls are removed?
// vultraz, 7/5/2017
}
// Determine the hexes to clear.
pathfind::vision_path sight(costs, slowed, sight_range, view_loc, jamming_);
// Give animations a chance to progress; see bug #20324.
if ( !instant && display::get_singleton() )
display::get_singleton()->draw(true);
// TODO: ^ is this something we need to worry about now that external draw calls are removed?
// vultraz, 7/5/2017
// Clear the fog.
for (const pathfind::paths::step &dest : sight.destinations) {

View file

@ -781,7 +781,7 @@ surface display::screenshot(bool map_screenshot)
// we reroute render output to the screenshot surface and invalidate all
map_screenshot_= true;
DBG_DP << "draw() with map_screenshot\n";
draw(true,true);
//draw(true,true);
// restore normal rendering
map_screenshot_= false;
@ -1788,7 +1788,7 @@ bool display::set_zoom(unsigned int amount, const bool validate_value_and_set_in
// Forces a redraw after zooming.
// This prevents some graphic glitches from occurring.
draw();
//draw();
return true;
}
@ -1840,7 +1840,7 @@ void display::scroll_to_xy(int screenxpos, int screenypos, SCROLL_TYPE scroll_ty
if(scroll_type == WARP || scroll_type == ONSCREEN_WARP || turbo_speed() > 2.0 || preferences::scroll_speed() > 99) {
scroll(xmove,ymove,true);
draw();
//draw();
return;
}
@ -1897,7 +1897,7 @@ void display::scroll_to_xy(int screenxpos, int screenypos, SCROLL_TYPE scroll_ty
scroll(dx,dy,true);
x_old += dx;
y_old += dy;
draw();
//draw();
}
}
@ -2507,75 +2507,6 @@ void display::read(const config& cfg)
// #define SLOW_THINGS_DOWN
void display::draw()
{
draw_new();
//draw(true, false);
}
void display::draw(bool update)
{
draw(update, false);
}
void display::draw(bool update, bool force)
{
return;
// log_scope("display::draw");
if(video_.update_locked()) {
return;
}
if (dirty_) {
flip_locker flip_lock(video_);
dirty_ = false;
redraw_everything();
return;
}
// Trigger cache rebuild when preference gets changed
if (animate_water_ != preferences::animate_water()) {
animate_water_ = preferences::animate_water();
builder_->rebuild_cache_all();
}
set_scontext_unsynced leave_synced_context;
draw_init();
pre_draw();
// invalidate all that needs to be invalidated
invalidate_animations();
// at this stage we have everything that needs to be invalidated for this redraw
// save it as the previous invalidated, and merge with the previous invalidated_
// we merge with the previous redraw because if a hex had a unit last redraw but
// not this one, nobody will tell us to redraw (cleanup)
// these new invalidations cannot cause any propagation because
// if a hex was invalidated last turn but not this turn, then
// * case of no unit in neighbor hex=> no propagation
// * case of unit in hex but was there last turn=>its hexes are invalidated too
// * case of unit in hex not there last turn => it moved, so was invalidated previously
if(!get_map().empty()) {
#ifdef SLOW_THINGS_DOWN
int simulate_delay = 0;
#endif
post_commit();
draw_sidebar();
#ifdef SLOW_THINGS_DOWN
SDL_Delay(2 * simulate_delay + rand() % 20);
#endif
}
draw_wrap(update, force);
post_draw();
}
void display::redraw_everything()
{
if(video_.update_locked()) {
@ -2621,7 +2552,7 @@ void display::redraw_everything()
int ticks1 = SDL_GetTicks();
//invalidate_all();
int ticks2 = SDL_GetTicks();
draw(true,true);
//draw(true,true);
int ticks3 = SDL_GetTicks();
LOG_DP << "invalidate and draw: " << (ticks3 - ticks2) << " and " << (ticks2 - ticks1) << "\n";
@ -2862,7 +2793,7 @@ void display::draw_hex(const map_location& loc)
#endif
}
void display::draw_new()
void display::draw()
{
// Execute any pre-draw actions from derived classes.
pre_draw();

View file

@ -543,13 +543,7 @@ public:
* Not virtual, since it gathers common actions. Calls various protected
* virtuals (further below) to allow specialized behavior in derived classes.
*/
virtual void draw();
void draw(bool update);
void draw(bool update, bool force);
void draw_new();
virtual void draw() override;
map_labels& labels();
const map_labels& labels() const;

View file

@ -288,9 +288,6 @@ void custom_tod::update_tod_display()
// redraw_everything() instead.
disp->update_tod(&get_selected_tod());
// redraw tiles
disp->draw(false);
}
void custom_tod::update_lawful_bonus(window& window)

View file

@ -3288,7 +3288,6 @@ int game_lua_kernel::intf_color_adjust(lua_State *L)
vconfig cfg(luaW_checkvconfig(L, 1));
game_display_->adjust_color_overlay(cfg["red"], cfg["green"], cfg["blue"]);
game_display_->draw(true,true);
}
return 0;
}
@ -3347,8 +3346,6 @@ int game_lua_kernel::intf_redraw(lua_State *L)
}
screen.recalculate_minimap();
}
screen.draw(true,true);
}
return 0;
}
@ -3646,7 +3643,6 @@ int game_lua_kernel::intf_scroll(lua_State * L)
if (game_display_) {
game_display_->scroll(x, y, true);
game_display_->draw(true, true);
}
return 0;

View file

@ -692,7 +692,6 @@ void unit_recruited(const map_location& loc,const map_location& leader_loc)
disp->scroll_to_tile(loc,game_display::ONSCREEN,true,false);
}
disp->draw();
u->set_hidden(false);
animator.add_animation(&*u, "recruited", loc, leader_loc);
animator.start_animations();