Removed 'sunset' command. Deals with bug #25460

Not really useful, this was. Better debug aids, we need.
This commit is contained in:
Charles Dang 2017-03-09 17:23:13 +11:00
parent a976d05c9b
commit 64ebefbffa
5 changed files with 1 additions and 61 deletions

View file

@ -72,7 +72,6 @@ namespace {
const unsigned int MinZoom = zoom_levels.front();
const unsigned int MaxZoom = zoom_levels.back();
size_t sunset_delay = 0;
bool benchmark = false;
@ -1312,12 +1311,6 @@ void display::drawing_buffer_clear()
drawing_buffer_.clear();
}
void display::sunset(const size_t delay)
{
// This allow both parametric and toggle use
sunset_delay = (sunset_delay == 0 && delay == 0) ? 3 : delay;
}
void display::toggle_benchmark()
{
benchmark = !benchmark;
@ -1336,15 +1329,6 @@ void display::flip()
surface& frameBuffer = video().getSurface();
// This is just the debug function "sunset" to progressively darken the map area
static size_t sunset_timer = 0;
if (sunset_delay && ++sunset_timer > sunset_delay) {
sunset_timer = 0;
SDL_Rect r = map_outside_area(); // Use frameBuffer to also test the UI
const Uint32 color = SDL_MapRGBA(video().getSurface()->format,0,0,0,SDL_ALPHA_OPAQUE);
// Adjust the alpha if you want to balance cpu-cost / smooth sunset
sdl::fill_rect_alpha(r, color, 1, frameBuffer);
}
font::draw_floating_labels(frameBuffer);
events::raise_volatile_draw_event();

View file

@ -437,15 +437,6 @@ public:
void clear_mouseover_hex_overlay()
{ mouseover_hex_overlay_ = nullptr; }
/**
* Debug function to toggle the "sunset" mode.
* The map area become progressively darker,
* except where hexes are refreshed.
* delay is the number of frames between each darkening
* (0 to toggle).
*/
static void sunset(const size_t delay = 0);
/** Toggle to continuously redraw the screen. */
static void toggle_benchmark();

View file

@ -103,8 +103,6 @@ public:
} // namespace implementation
REGISTER_WIDGET(window)
unsigned window::sunset_ = 0;
namespace
{
#ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
@ -746,18 +744,6 @@ void window::draw()
}
if (dirty_list_.empty()) {
if (sunset_) {
/** @todo should probably be moved to event::sdl_event_handler::draw. */
static unsigned i = 0;
if (++i % sunset_ == 0) {
SDL_Rect r = sdl::create_rect(
0, 0, frame_buffer->w, frame_buffer->h);
const Uint32 color
= SDL_MapRGBA(frame_buffer->format, 0, 0, 0, SDL_ALPHA_OPAQUE);
sdl::fill_rect_alpha(r, color, 1, frame_buffer);
}
}
return;
}

View file

@ -440,11 +440,6 @@ public:
click_dismiss_ = click_dismiss;
}
static void set_sunset(const unsigned interval)
{
sunset_ = interval ? interval : 5;
}
bool get_need_layout() const
{
return need_layout_;
@ -612,15 +607,6 @@ private:
/** Disable the escape key see our setter for more info. */
bool escape_disabled_;
/**
* Controls the sunset feature.
*
* If this value is not 0 it will darken the entire screen every
* sunset_th drawing request that nothing has been modified. It's a debug
* feature.
*/
static unsigned sunset_;
/**
* Helper struct to force widgets the have the same size.
*

View file

@ -1008,7 +1008,6 @@ class console_handler : public map_command_handler<console_handler>, private cha
void do_control();
void do_controller();
void do_clear();
void do_sunset();
void do_foreground();
void do_layers();
void do_fps();
@ -1094,8 +1093,6 @@ class console_handler : public map_command_handler<console_handler>, private cha
_("Query the controller status of a side."), _("<side>"));
register_command("clear", &console_handler::do_clear,
_("Clear chat history."));
register_command("sunset", &console_handler::do_sunset,
_("Visualize the screen refresh procedure."), "", "D");
register_command("foreground", &console_handler::do_foreground,
_("Debug foreground terrain."), "", "D");
register_command("layers", &console_handler::do_layers,
@ -1489,11 +1486,7 @@ void console_handler::do_controller()
void console_handler::do_clear() {
menu_handler_.gui_->get_chat_manager().clear_chat_messages();
}
void console_handler::do_sunset() {
int delay = lexical_cast_default<int>(get_data());
menu_handler_.gui_->sunset(delay);
gui2::window::set_sunset(delay);
}
void console_handler::do_foreground() {
menu_handler_.gui_->toggle_debug_foreground();
}