mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-25 01:55:07 +00:00
Remove unused functions
* palette_manager::restore_palette_bg * display::post_commit, flip, update_display * widget::hide_override * widget::bg_restore, bg_unregister, bg_update, bg_clear
This commit is contained in:
parent
c33c452ffe
commit
422b856eec
@ -2470,7 +2470,6 @@ void display::draw()
|
||||
invalidated_.clear();
|
||||
}
|
||||
drawing_buffer_commit();
|
||||
post_commit();
|
||||
}
|
||||
|
||||
if(preferences::show_fps() || benchmark) {
|
||||
|
@ -471,12 +471,6 @@ public:
|
||||
|
||||
terrain_builder& get_builder() {return *builder_;}
|
||||
|
||||
// TODO: draw_manager - remove
|
||||
void flip() {}
|
||||
|
||||
// TODO: draw_manager - remove
|
||||
/** Copy the backbuffer to the framebuffer. */
|
||||
void update_display() {}
|
||||
void update_fps_label();
|
||||
void clear_fps_label();
|
||||
void update_fps_count();
|
||||
@ -732,12 +726,6 @@ protected:
|
||||
*/
|
||||
virtual void draw_invalidated();
|
||||
|
||||
/**
|
||||
* Hook for actions to take right after draw() calls drawing_buffer_commit
|
||||
* No action here by default.
|
||||
*/
|
||||
virtual void post_commit() {}
|
||||
|
||||
/**
|
||||
* Redraws a single gamemap location.
|
||||
*/
|
||||
|
@ -48,11 +48,9 @@ void palette_manager::set_group(std::size_t index)
|
||||
|
||||
void palette_manager::adjust_size()
|
||||
{
|
||||
restore_palette_bg(false);
|
||||
const SDL_Rect& rect = gui_.palette_area();
|
||||
set_location(rect);
|
||||
palette_start_ = rect.y;
|
||||
bg_register(rect);
|
||||
active_palette().adjust_size(rect);
|
||||
set_dirty();
|
||||
}
|
||||
@ -87,17 +85,7 @@ void palette_manager::scroll_up()
|
||||
|
||||
void palette_manager::scroll_top()
|
||||
{
|
||||
restore_palette_bg(true);
|
||||
}
|
||||
|
||||
// TODO: draw_manager - can probably remove this...
|
||||
void palette_manager::restore_palette_bg(bool scroll_top)
|
||||
{
|
||||
const SDL_Rect rect = gui_.palette_area();
|
||||
if (scroll_top) {
|
||||
active_palette().set_start_item(0);
|
||||
}
|
||||
bg_restore(rect);
|
||||
active_palette().set_start_item(0);
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,6 @@ public:
|
||||
bool can_scroll_down();
|
||||
|
||||
void scroll_top();
|
||||
void restore_palette_bg(bool scroll_top);
|
||||
void scroll_bottom();
|
||||
|
||||
//TODO
|
||||
|
@ -148,9 +148,6 @@ protected:
|
||||
|
||||
virtual void draw_invalidated() override;
|
||||
|
||||
// TODO: draw_manager - maybe delete
|
||||
//virtual void post_commit() override;
|
||||
|
||||
virtual void draw_hex(const map_location& loc) override;
|
||||
|
||||
/** Inherited from display. */
|
||||
|
@ -57,9 +57,8 @@ help_text_area::help_text_area(const section &toplevel) :
|
||||
set_scroll_rate(40);
|
||||
}
|
||||
|
||||
void help_text_area::set_inner_location(const SDL_Rect& rect)
|
||||
void help_text_area::set_inner_location(const SDL_Rect& /*rect*/)
|
||||
{
|
||||
bg_register(rect);
|
||||
if (shown_topic_)
|
||||
set_items();
|
||||
}
|
||||
@ -541,7 +540,6 @@ int help_text_area::get_remaining_width()
|
||||
void help_text_area::draw_contents()
|
||||
{
|
||||
const SDL_Rect& loc = inner_location();
|
||||
//bg_restore();
|
||||
auto clipper = draw::reduce_clip(loc);
|
||||
for(std::list<item>::const_iterator it = items_.begin(), end = items_.end(); it != end; ++it) {
|
||||
SDL_Rect dst = it->rect_;
|
||||
|
@ -110,8 +110,6 @@ void teleport_unit_between(const map_location& a, const map_location& b, unit& t
|
||||
}
|
||||
|
||||
temp_unit.anim_comp().set_standing();
|
||||
// TODO: draw_manager - ugh, don't. WTF do you even think you're doing here
|
||||
disp.update_display();
|
||||
events::pump();
|
||||
}
|
||||
|
||||
|
@ -331,11 +331,10 @@ int menu::selection() const
|
||||
return items_[selected_].id;
|
||||
}
|
||||
|
||||
void menu::set_inner_location(const SDL_Rect& rect)
|
||||
void menu::set_inner_location(const SDL_Rect& /*rect*/)
|
||||
{
|
||||
itemRects_.clear();
|
||||
update_scrollbar_grip_height();
|
||||
bg_register(rect);
|
||||
}
|
||||
|
||||
void menu::change_item(int pos1, int pos2,const std::string& str)
|
||||
@ -785,8 +784,6 @@ SDL_Rect menu::style::item_size(const std::string& item) const {
|
||||
|
||||
void menu::style::draw_row_bg(menu& /*menu_ref*/, const std::size_t /*row_index*/, const SDL_Rect& rect, ROW_TYPE type)
|
||||
{
|
||||
//menu_ref.bg_restore(rect);
|
||||
|
||||
int rgb = 0;
|
||||
double alpha = 0.0;
|
||||
|
||||
@ -869,7 +866,7 @@ void menu::clear_item(int item)
|
||||
SDL_Rect rect = get_item_rect(item);
|
||||
if (rect.w == 0)
|
||||
return;
|
||||
bg_restore(rect);
|
||||
queue_redraw(rect);
|
||||
}
|
||||
|
||||
void menu::draw_row(const std::size_t row_index, const SDL_Rect& loc, ROW_TYPE type)
|
||||
|
@ -66,8 +66,6 @@ void scrollarea::test_scrollbar()
|
||||
return;
|
||||
recursive_ = true;
|
||||
if (shown_scrollbar_ != has_scrollbar()) {
|
||||
bg_restore();
|
||||
bg_cancel();
|
||||
update_location(location());
|
||||
}
|
||||
recursive_ = false;
|
||||
|
@ -63,9 +63,8 @@ void textbox::update_location(const SDL_Rect& rect)
|
||||
set_dirty(true);
|
||||
}
|
||||
|
||||
void textbox::set_inner_location(const SDL_Rect& rect)
|
||||
void textbox::set_inner_location(const SDL_Rect& /*rect*/)
|
||||
{
|
||||
bg_register(rect);
|
||||
if (!text_image_) return;
|
||||
text_pos_ = 0;
|
||||
update_text_cache(false);
|
||||
|
@ -32,8 +32,8 @@ namespace gui {
|
||||
bool widget::mouse_lock_ = false;
|
||||
|
||||
widget::widget(const bool auto_join)
|
||||
: events::sdl_handler(auto_join), focus_(true), rect_(EmptyRect), needs_restore_(false),
|
||||
state_(UNINIT), hidden_override_(false), enabled_(true), clip_(false),
|
||||
: events::sdl_handler(auto_join), focus_(true), rect_(EmptyRect),
|
||||
state_(UNINIT), enabled_(true), clip_(false),
|
||||
clip_rect_(EmptyRect), has_help_(false), mouse_lock_local_(false)
|
||||
{
|
||||
}
|
||||
@ -43,7 +43,6 @@ widget::~widget()
|
||||
if (!hidden()) {
|
||||
queue_redraw();
|
||||
}
|
||||
bg_cancel();
|
||||
free_mouse_lock();
|
||||
}
|
||||
|
||||
@ -68,35 +67,24 @@ bool widget::mouse_locked() const
|
||||
return mouse_lock_ && !mouse_lock_local_;
|
||||
}
|
||||
|
||||
// TODO: draw_manager - kill surface restorers
|
||||
void widget::bg_cancel()
|
||||
{
|
||||
/*for(std::vector< surface_restorer >::iterator i = restorer_.begin(),
|
||||
i_end = restorer_.end(); i != i_end; ++i)
|
||||
i->cancel();*/
|
||||
restorer_.clear();
|
||||
}
|
||||
|
||||
void widget::set_location(const SDL_Rect& rect)
|
||||
{
|
||||
if(rect_.x == rect.x && rect_.y == rect.y && rect_.w == rect.w && rect_.h == rect.h)
|
||||
return;
|
||||
|
||||
// If we were shown somewhere else, queue it to be cleared.
|
||||
if(state_ == DIRTY || state_ == DRAWN) {
|
||||
queue_redraw();
|
||||
}
|
||||
|
||||
if(state_ == UNINIT && rect.x != -1234 && rect.y != -1234)
|
||||
state_ = DRAWN;
|
||||
|
||||
// TODO: draw_manager - overhaul
|
||||
bg_restore();
|
||||
bg_cancel();
|
||||
rect_ = rect;
|
||||
set_dirty(true);
|
||||
update_location(rect);
|
||||
}
|
||||
|
||||
void widget::update_location(const SDL_Rect& rect)
|
||||
{
|
||||
bg_register(rect);
|
||||
}
|
||||
|
||||
void widget::layout()
|
||||
{
|
||||
// this basically happens in set_location, so there's nothing to do here.
|
||||
@ -107,11 +95,6 @@ const SDL_Rect* widget::clip_rect() const
|
||||
return clip_ ? &clip_rect_ : nullptr;
|
||||
}
|
||||
|
||||
void widget::bg_register(const SDL_Rect& rect)
|
||||
{
|
||||
restorer_.emplace_back(rect);
|
||||
}
|
||||
|
||||
void widget::set_location(int x, int y)
|
||||
{
|
||||
set_location({x, y, rect_.w, rect_.h});
|
||||
@ -163,29 +146,13 @@ bool widget::focus(const SDL_Event* event)
|
||||
void widget::hide(bool value)
|
||||
{
|
||||
if (value) {
|
||||
if ((state_ == DIRTY || state_ == DRAWN) && !hidden_override_)
|
||||
bg_restore();
|
||||
if (state_ == DIRTY || state_ == DRAWN) {
|
||||
queue_redraw();
|
||||
}
|
||||
state_ = HIDDEN;
|
||||
} else if (state_ == HIDDEN) {
|
||||
state_ = DRAWN;
|
||||
if (!hidden_override_) {
|
||||
bg_update();
|
||||
set_dirty(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void widget::hide_override(bool value) {
|
||||
if (hidden_override_ != value) {
|
||||
hidden_override_ = value;
|
||||
if (state_ == DIRTY || state_ == DRAWN) {
|
||||
if (value) {
|
||||
bg_restore();
|
||||
} else {
|
||||
bg_update();
|
||||
set_dirty(true);
|
||||
}
|
||||
}
|
||||
set_dirty(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,7 +165,7 @@ void widget::set_clip_rect(const SDL_Rect& rect)
|
||||
|
||||
bool widget::hidden() const
|
||||
{
|
||||
return (state_ == HIDDEN || hidden_override_ || state_ == UNINIT
|
||||
return (state_ == HIDDEN || state_ == UNINIT
|
||||
|| (clip_ && !rect_.overlaps(clip_rect_)));
|
||||
}
|
||||
|
||||
@ -218,15 +185,13 @@ bool widget::enabled() const
|
||||
// TODO: draw_manager - this needs to die
|
||||
void widget::set_dirty(bool dirty)
|
||||
{
|
||||
if ((dirty && (hidden_override_ || state_ != DRAWN)) || (!dirty && state_ != DIRTY))
|
||||
if ((dirty && state_ != DRAWN) || (!dirty && state_ != DIRTY))
|
||||
return;
|
||||
|
||||
state_ = dirty ? DIRTY : DRAWN;
|
||||
if (dirty) {
|
||||
queue_redraw();
|
||||
}
|
||||
//if (!dirty)
|
||||
// needs_restore_ = true;
|
||||
}
|
||||
|
||||
bool widget::dirty() const
|
||||
@ -246,43 +211,6 @@ void widget::set_id(const std::string& id)
|
||||
}
|
||||
}
|
||||
|
||||
void widget::bg_update()
|
||||
{
|
||||
/*for(std::vector< surface_restorer >::iterator i = restorer_.begin(),
|
||||
i_end = restorer_.end(); i != i_end; ++i)
|
||||
i->update();*/
|
||||
}
|
||||
|
||||
void widget::bg_restore() const
|
||||
{
|
||||
if (needs_restore_) {
|
||||
for(const rect& r : restorer_) {
|
||||
if(clip_) {
|
||||
draw_manager::invalidate_region(r.intersect(clip_rect_));
|
||||
} else {
|
||||
draw_manager::invalidate_region(r);
|
||||
}
|
||||
}
|
||||
/*for(std::vector< surface_restorer >::const_iterator i = restorer_.begin(),
|
||||
i_end = restorer_.end(); i != i_end; ++i)
|
||||
i->restore();*/
|
||||
needs_restore_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
void widget::bg_restore(const SDL_Rect& where) const
|
||||
{
|
||||
rect c = clip_ ? clip_rect_ : where;
|
||||
c.clip(where);
|
||||
|
||||
for(const rect& r : restorer_) {
|
||||
draw_manager::invalidate_region(r.intersect(c));
|
||||
}
|
||||
/*for(std::vector< surface_restorer >::const_iterator i = restorer_.begin(),
|
||||
i_end = restorer_.end(); i != i_end; ++i)
|
||||
i->restore(rect);*/
|
||||
}
|
||||
|
||||
void widget::queue_redraw(const rect& r)
|
||||
{
|
||||
draw_manager::invalidate_region(r);
|
||||
@ -309,8 +237,6 @@ void widget::draw()
|
||||
if (hidden())
|
||||
return;
|
||||
|
||||
//bg_restore();
|
||||
|
||||
if (clip_) {
|
||||
auto clipper = draw::reduce_clip(clip_rect_);
|
||||
draw_contents();
|
||||
|
@ -70,14 +70,6 @@ protected:
|
||||
widget(const bool auto_join=true);
|
||||
virtual ~widget();
|
||||
|
||||
// During each relocation, this function should be called to register
|
||||
// the rectangles the widget needs to refresh automatically
|
||||
void bg_register(const SDL_Rect& rect); // TODO: draw_manager - remove
|
||||
void bg_restore() const; // TODO: draw_manager - remove
|
||||
void bg_restore(const SDL_Rect& rect) const; // TODO: draw_manager - remove
|
||||
void bg_update(); // TODO: draw_manager - remove
|
||||
void bg_cancel(); // TODO: draw_manager - remove
|
||||
|
||||
public:
|
||||
/* draw_manager interface */
|
||||
|
||||
@ -92,7 +84,7 @@ public:
|
||||
virtual void draw() override; // TODO: draw_manager - private nonvirtual
|
||||
protected:
|
||||
virtual void draw_contents() {}
|
||||
virtual void update_location(const SDL_Rect& rect);
|
||||
virtual void update_location(const SDL_Rect&) {};
|
||||
|
||||
const SDL_Rect* clip_rect() const;
|
||||
|
||||
@ -103,15 +95,11 @@ protected:
|
||||
|
||||
void aquire_mouse_lock();
|
||||
void free_mouse_lock();
|
||||
private:
|
||||
void hide_override(bool value = true);
|
||||
|
||||
std::vector<rect> restorer_;
|
||||
private:
|
||||
rect rect_;
|
||||
mutable bool needs_restore_; // Have we drawn ourselves, so that if moved, we need to restore the background?
|
||||
|
||||
enum { UNINIT, HIDDEN, DIRTY, DRAWN } state_;
|
||||
bool hidden_override_;
|
||||
bool enabled_;
|
||||
bool clip_;
|
||||
SDL_Rect clip_rect_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user