Merge lp:~widelands-dev/widelands/remove_update into lp:widelands

Proposed by SirVer
Status: Merged
Merged at revision: 7758
Proposed branch: lp:~widelands-dev/widelands/remove_update
Merge into: lp:widelands
Diff against target: 1233 lines (+20/-280)
34 files modified
src/editor/ui_menus/editor_tool_menu.cc (+0/-1)
src/graphic/graphic.cc (+0/-19)
src/graphic/graphic.h (+0/-5)
src/logic/map_objects/tribes/production_program.cc (+1/-1)
src/ui_basic/button.cc (+1/-11)
src/ui_basic/checkbox.cc (+0/-7)
src/ui_basic/editbox.cc (+0/-13)
src/ui_basic/icon.cc (+0/-1)
src/ui_basic/listselect.cc (+0/-7)
src/ui_basic/multilineeditbox.cc (+0/-8)
src/ui_basic/multilinetextarea.cc (+0/-6)
src/ui_basic/panel.cc (+13/-102)
src/ui_basic/panel.h (+0/-3)
src/ui_basic/progressbar.cc (+0/-4)
src/ui_basic/progresswindow.cc (+1/-3)
src/ui_basic/scrollbar.cc (+0/-5)
src/ui_basic/slider.cc (+1/-17)
src/ui_basic/table.cc (+0/-8)
src/ui_basic/tabpanel.cc (+0/-7)
src/ui_basic/textarea.cc (+0/-2)
src/ui_basic/window.cc (+0/-1)
src/wui/game_message_menu.cc (+0/-3)
src/wui/game_summary.cc (+0/-1)
src/wui/game_tips.cc (+0/-2)
src/wui/interactive_base.cc (+0/-5)
src/wui/itemwaresdisplay.cc (+1/-5)
src/wui/mapview.cc (+0/-2)
src/wui/minimap.cc (+0/-2)
src/wui/productionsitewindow.cc (+0/-1)
src/wui/soldierlist.cc (+0/-1)
src/wui/waresdisplay.cc (+0/-14)
src/wui/waresdisplay.h (+0/-3)
src/wui/waresqueuedisplay.cc (+2/-9)
src/wui/waresqueuedisplay.h (+0/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/remove_update
Reviewer Review Type Date Requested Status
GunChleoc testing Approve
Review via email: mp+284524@code.launchpad.net

Commit message

Removed graphic::update() and Panel::update() and always redraw at maxfps.
Changed default maxfps to 30 (instead of 25).

Description of the change

The UI kept track of changes that happened - if you did not move the mouse in a menu, it would not redraw the screen. That was nice, because it meant that Widelands would not eat any CPU in a menu. Ingame we always redraw at maxfps anyways, so this request does not change anything there.

Keeping track of the dirty state has a lot of complexity though - each widget has to remember to call update() when it needs to be redrawn. Even worse, in-game, each widget needs to get reminded to update if some external state changes. That is easy to get wrong.

This change makes Widelands use more CPU in menus when you do not interact with the game (13% CPU vs 3% before on my system, but if you move the mouse it is equal), but it makes the code easier to reason about and less prone to bugs. A lot of the widgets could now be written much simpler - since they do not need to try to cache state (for example WaresQueueDisplay). It seems to me that it should go in, but I am not sure.

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

Hi, I am bunnybot (https://github.com/widelands/bunnybot).

I am keeping the source branch lp:~widelands-dev/widelands/remove_update mirrored to https://github.com/widelands/widelands/tree/_widelands_dev_widelands_remove_update

You can give me commands by starting a line with @bunnybot <command>. I understand:
 merge: Merges the source branch into the target branch, closing the merge proposal. I will use the proposed commit message if it is set.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 453. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/105948529.
Appveyor build 350. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_remove_update-350.

Revision history for this message
GunChleoc (gunchleoc) wrote :

I find update annoying and difficult too, so I'm all for it. I expect that the added CPU load won't increase for long games, so I think we can afford the extra CPU time - the recent graphics changes have already saved a lot, so we'll still be better off than we were before you started working on the graphics.

Code LGTM, just 1 question. Not tested yet.

review: Approve (code)
Revision history for this message
GunChleoc (gunchleoc) wrote :

I have tested this now - everything seems ok.

review: Approve (testing)
Revision history for this message
SirVer (sirver) wrote :

@bunnybot merge

Revision history for this message
bunnybot (widelandsofficial) wrote :

Bunnybot encountered an error while working on this merge proposal:

Running 'bzr merge ../_widelands_dev_widelands_remove_update' failed. Output:

 M src/editor/ui_menus/editor_tool_menu.cc
 M src/graphic/graphic.cc
 M src/graphic/graphic.h
 M src/logic/map_objects/tribes/production_program.cc
 M src/ui_basic/button.cc
 M src/ui_basic/checkbox.cc
 M src/ui_basic/editbox.cc
 M src/ui_basic/icon.cc
 M src/ui_basic/listselect.cc
 M src/ui_basic/multilineeditbox.cc
 M src/ui_basic/multilinetextarea.cc
 M src/ui_basic/panel.cc
 M src/ui_basic/panel.h
 M src/ui_basic/progressbar.cc
 M src/ui_basic/progresswindow.cc
 M src/ui_basic/scrollbar.cc
 M src/ui_basic/slider.cc
 M src/ui_basic/table.cc
 M src/ui_basic/tabpanel.cc
 M src/ui_basic/textarea.cc
 M src/ui_basic/window.cc
 M src/wui/game_message_menu.cc
 M src/wui/game_summary.cc
 M src/wui/game_tips.cc
 M src/wui/interactive_base.cc
 M src/wui/itemwaresdisplay.cc
 M src/wui/mapview.cc
 M src/wui/minimap.cc
 M src/wui/productionsitewindow.cc
 M src/wui/soldierlist.cc
 M src/wui/waresdisplay.cc
 M src/wui/waresdisplay.h
 M src/wui/waresqueuedisplay.cc
 M src/wui/waresqueuedisplay.h
Text conflict in src/ui_basic/editbox.cc
1 conflicts encountered.

Revision history for this message
SirVer (sirver) wrote :

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/editor/ui_menus/editor_tool_menu.cc'
2--- src/editor/ui_menus/editor_tool_menu.cc 2016-01-18 19:35:25 +0000
3+++ src/editor/ui_menus/editor_tool_menu.cc 2016-01-31 14:49:41 +0000
4@@ -152,7 +152,6 @@
5 parent.mutable_field_overlay_manager()->register_overlay_callback_function(
6 boost::bind(&editor_Tool_set_port_space_callback, _1, boost::ref(map)));
7 map.recalc_whole_map(parent.egbase().world());
8- update();
9 }
10
11 if (current_registry_pointer) {
12
13=== modified file 'src/graphic/graphic.cc'
14--- src/graphic/graphic.cc 2016-01-28 07:00:21 +0000
15+++ src/graphic/graphic.cc 2016-01-31 14:49:41 +0000
16@@ -76,7 +76,6 @@
17 bool init_fullscreen) {
18 window_mode_width_ = window_mode_w;
19 window_mode_height_ = window_mode_h;
20- requires_update_ = true;
21
22 if (SDL_GL_LoadLibrary(nullptr) == -1) {
23 throw wexception("SDL_GL_LoadLibrary failed: %s", SDL_GetError());
24@@ -169,8 +168,6 @@
25 render_target_.reset(new RenderTarget(screen_.get()));
26
27 Notifications::publish(GraphicResolutionChanged{new_w, new_h});
28-
29- update();
30 }
31
32 /**
33@@ -214,18 +211,6 @@
34 resolution_changed();
35 }
36
37-
38-void Graphic::update() {
39- requires_update_ = true;
40-}
41-
42-/**
43- * Returns true if parts of the screen have been marked for refreshing.
44-*/
45-bool Graphic::need_update() const {
46- return requires_update_;
47-}
48-
49 /**
50 * Bring the screen uptodate.
51 */
52@@ -255,7 +240,6 @@
53 }
54
55 SDL_GL_SwapWindow(sdl_window_);
56- requires_update_ = false;
57 }
58
59 /**
60@@ -264,7 +248,4 @@
61 void Graphic::screenshot(const string& fname)
62 {
63 screenshot_filename_ = fname;
64-
65- // Force a redraw of the screen soon.
66- update();
67 }
68
69=== modified file 'src/graphic/graphic.h'
70--- src/graphic/graphic.h 2016-01-24 12:43:26 +0000
71+++ src/graphic/graphic.h 2016-01-31 14:49:41 +0000
72@@ -71,8 +71,6 @@
73 void set_fullscreen(bool);
74
75 RenderTarget * get_render_target();
76- void update();
77- bool need_update() const;
78 void refresh();
79 SDL_Window* get_sdlwindow() {return sdl_window_;}
80
81@@ -103,9 +101,6 @@
82 /// A RenderTarget for screen_. This is initialized during init()
83 std::unique_ptr<RenderTarget> render_target_;
84
85- /// This marks the complete screen for updating.
86- bool requires_update_;
87-
88 /// Non-volatile cache of independent images.
89 std::unique_ptr<ImageCache> image_cache_;
90
91
92=== modified file 'src/logic/map_objects/tribes/production_program.cc'
93--- src/logic/map_objects/tribes/production_program.cc 2016-01-24 07:45:11 +0000
94+++ src/logic/map_objects/tribes/production_program.cc 2016-01-31 14:49:41 +0000
95@@ -121,7 +121,7 @@
96 } else if (*p != *pattern)
97 return false;
98
99- return false;
100+ NEVER_HERE();
101 }
102
103 ProductionProgram::ActReturn::Condition * create_economy_condition
104
105=== modified file 'src/ui_basic/button.cc'
106--- src/ui_basic/button.cc 2015-11-28 14:19:26 +0000
107+++ src/ui_basic/button.cc 2016-01-31 14:49:41 +0000
108@@ -107,8 +107,6 @@
109 return;
110
111 m_pic_custom = pic;
112-
113- update();
114 }
115
116
117@@ -121,8 +119,6 @@
118
119 m_pic_custom = nullptr;
120 m_title = title;
121-
122- update();
123 }
124
125
126@@ -147,7 +143,6 @@
127 m_enabled = false;
128 m_highlighted = false;
129 }
130- update();
131 }
132
133
134@@ -319,8 +314,6 @@
135 sigmousein();
136 else
137 sigmouseout();
138-
139- update();
140 }
141
142
143@@ -340,10 +333,9 @@
144 set_thinks(true);
145 }
146 }
147- update();
148-
149 return true;
150 }
151+
152 bool Button::handle_mouserelease(uint8_t const btn, int32_t, int32_t) {
153 if (btn != SDL_BUTTON_LEFT)
154 return false;
155@@ -352,7 +344,6 @@
156 m_pressed = false;
157 set_thinks(false);
158 grab_mouse(false);
159- update();
160 if (m_highlighted && m_enabled) {
161 play_click();
162 sigclicked();
163@@ -372,7 +363,6 @@
164 void Button::set_perm_pressed(bool state) {
165 if (state != m_permpressed) {
166 m_permpressed = state;
167- update();
168 }
169 }
170
171
172=== modified file 'src/ui_basic/checkbox.cc'
173--- src/ui_basic/checkbox.cc 2015-12-17 09:36:59 +0000
174+++ src/ui_basic/checkbox.cc 2016-01-31 14:49:41 +0000
175@@ -98,8 +98,6 @@
176 set_flags
177 (Is_Highlighted, (m_flags & Is_Highlighted) && (m_flags & Is_Enabled));
178 }
179-
180- update();
181 }
182
183
184@@ -113,7 +111,6 @@
185 set_flags(Is_Checked, on);
186 changed();
187 changedto(on);
188- update();
189 }
190 }
191
192@@ -170,11 +167,7 @@
193 * Highlight the checkbox when the mouse moves into it
194 */
195 void Statebox::handle_mousein(bool const inside) {
196- bool oldhl = m_flags & Is_Highlighted;
197 set_flags(Is_Highlighted, inside && (m_flags & Is_Enabled));
198-
199- if (oldhl != (m_flags & Is_Highlighted))
200- update();
201 }
202
203
204
205=== modified file 'src/ui_basic/editbox.cc'
206--- src/ui_basic/editbox.cc 2016-01-29 08:50:22 +0000
207+++ src/ui_basic/editbox.cc 2016-01-31 14:49:41 +0000
208@@ -134,8 +134,6 @@
209 m->text.erase(m->text.begin() + m->maxLength, m->text.end());
210 if (caretatend || m->caret > m->text.size())
211 m->caret = m->text.size();
212-
213- update();
214 }
215
216
217@@ -164,7 +162,6 @@
218 m->caret = m->text.size();
219
220 check_caret();
221- update();
222 }
223 }
224
225@@ -176,7 +173,6 @@
226 {
227 if (btn == SDL_BUTTON_LEFT && get_can_focus()) {
228 focus();
229- update();
230 return true;
231 }
232
233@@ -238,7 +234,6 @@
234 m->text.erase(m->text.begin() + m->caret);
235 check_caret();
236 changed();
237- update();
238 }
239 return true;
240
241@@ -256,8 +251,6 @@
242 break;
243
244 check_caret();
245-
246- update();
247 }
248 return true;
249
250@@ -281,7 +274,6 @@
251 }
252
253 check_caret();
254- update();
255 }
256 return true;
257
258@@ -295,7 +287,6 @@
259 m->caret = 0;
260
261 check_caret();
262- update();
263 }
264 return true;
265
266@@ -308,7 +299,6 @@
267 if (m->caret != m->text.size()) {
268 m->caret = m->text.size();
269 check_caret();
270- update();
271 }
272 return true;
273
274@@ -326,7 +316,6 @@
275 m->text = m_history[m_history_position];
276 m->caret = m->text.size();
277 check_caret();
278- update();
279 }
280 }
281 return true;
282@@ -345,7 +334,6 @@
283 m->text = m_history[m_history_position];
284 m->caret = m->text.size();
285 check_caret();
286- update();
287 }
288 }
289 return true;
290@@ -364,7 +352,6 @@
291 m->caret += input_text.length();
292 check_caret();
293 changed();
294- update();
295 }
296 return true;
297 }
298
299=== modified file 'src/ui_basic/icon.cc'
300--- src/ui_basic/icon.cc 2014-12-04 09:00:20 +0000
301+++ src/ui_basic/icon.cc 2016-01-31 14:49:41 +0000
302@@ -38,7 +38,6 @@
303
304 void Icon::set_icon(const Image* picture_id) {
305 m_pic = picture_id;
306- update();
307 }
308
309 void Icon::set_frame(const RGBColor& color)
310
311=== modified file 'src/ui_basic/listselect.cc'
312--- src/ui_basic/listselect.cc 2016-01-28 21:27:04 +0000
313+++ src/ui_basic/listselect.cc 2016-01-31 14:49:41 +0000
314@@ -152,8 +152,6 @@
315
316 m_scrollbar.set_steps(m_entry_records.size() * get_lineheight() - get_h());
317
318- update(0, 0, get_w(), get_h());
319-
320 if (sel)
321 select(m_entry_records.size() - 1);
322 }
323@@ -194,8 +192,6 @@
324
325 m_scrollbar.set_steps(m_entry_records.size() * get_lineheight() - get_h());
326
327- update(0, 0, get_w(), get_h());
328-
329 if (sel)
330 select(0);
331 }
332@@ -254,8 +250,6 @@
333 return;
334
335 m_scrollpos = i;
336-
337- update(0, 0, get_w(), get_h());
338 }
339
340
341@@ -291,7 +285,6 @@
342 m_selection = i;
343
344 selected(m_selection);
345- update(0, 0, get_w(), get_h());
346 }
347
348 /**
349
350=== modified file 'src/ui_basic/multilineeditbox.cc'
351--- src/ui_basic/multilineeditbox.cc 2016-01-28 21:27:04 +0000
352+++ src/ui_basic/multilineeditbox.cc 2016-01-31 14:49:41 +0000
353@@ -122,7 +122,6 @@
354 void MultilineEditbox::Data::update()
355 {
356 ww_valid = false;
357- owner.update();
358 }
359
360 /**
361@@ -443,7 +442,6 @@
362 */
363 void MultilineEditbox::focus(bool topcaller) {
364 Panel::focus(topcaller);
365- update();
366 }
367
368 /**
369@@ -499,8 +497,6 @@
370 void MultilineEditbox::Data::insert(uint32_t where, const std::string & s)
371 {
372 text.insert(where, s);
373- update();
374-
375 if (cursor_pos >= where)
376 set_cursor_pos(cursor_pos + s.size());
377 }
378@@ -517,7 +513,6 @@
379 return;
380
381 cursor_pos = newpos;
382- owner.update();
383
384 scroll_cursor_into_view();
385 }
386@@ -538,10 +533,8 @@
387
388 if (top < int32_t(scrollbar.get_scrollpos())) {
389 scrollbar.set_scrollpos(top - lineheight);
390- owner.update();
391 } else if (top + lineheight > int32_t(scrollbar.get_scrollpos()) + owner.get_h()) {
392 scrollbar.set_scrollpos(top - owner.get_h() + 2 * lineheight);
393- owner.update();
394 }
395 }
396
397@@ -550,7 +543,6 @@
398 */
399 void MultilineEditbox::scrollpos_changed(int32_t)
400 {
401- update();
402 }
403
404 /**
405
406=== modified file 'src/ui_basic/multilinetextarea.cc'
407--- src/ui_basic/multilinetextarea.cc 2016-01-29 08:50:22 +0000
408+++ src/ui_basic/multilinetextarea.cc 2016-01-31 14:49:41 +0000
409@@ -59,8 +59,6 @@
410 m_scrollbar.set_force_draw(always_show_scrollbar);
411
412 recompute();
413-
414- update(0, 0, get_eff_w(), get_h());
415 }
416
417
418@@ -113,8 +111,6 @@
419 break; // No need to wrap twice.
420 }
421 }
422-
423- update(0, 0, get_eff_w(), get_h());
424 }
425
426 /**
427@@ -122,7 +118,6 @@
428 */
429 void MultilineTextarea::scrollpos_changed(int32_t const /* pixels */)
430 {
431- update(0, 0, get_eff_w(), get_h());
432 }
433
434 /**
435@@ -194,7 +189,6 @@
436
437 void MultilineTextarea::scroll_to_top() {
438 m_scrollbar.set_scrollpos(0);
439- update(0, 0, 0, 0);
440 }
441
442 } // namespace UI
443
444=== modified file 'src/ui_basic/panel.cc'
445--- src/ui_basic/panel.cc 2016-01-27 08:06:40 +0000
446+++ src/ui_basic/panel.cc 2016-01-31 14:49:41 +0000
447@@ -73,7 +73,6 @@
448 _parent->_fchild = this;
449 } else
450 _prev = _next = nullptr;
451- update(0, 0, _w, _h);
452 }
453
454 /**
455@@ -81,8 +80,6 @@
456 */
457 Panel::~Panel()
458 {
459- update();
460-
461 // Release pointers to this object
462 if (_g_mousegrab == this)
463 _g_mousegrab = nullptr;
464@@ -150,15 +147,9 @@
465
466 // Panel-specific startup code. This might call end_modal()!
467 start();
468- g_gr->update();
469
470- uint32_t minTime;
471- {
472- int maxfps = g_options.pull_section("global").get_int("maxfps", 25);
473- if (maxfps < 5)
474- maxfps = 5;
475- minTime = 1000 / maxfps;
476- }
477+ const uint32_t minimum_frame_time =
478+ 1000 / std::max(5, g_options.pull_section("global").get_int("maxfps", 30));
479
480 while (_running) {
481 const uint32_t startTime = SDL_GetTicks();
482@@ -178,32 +169,22 @@
483
484 do_think();
485
486- if (g_gr->need_update()) {
487- RenderTarget & rt = *g_gr->get_render_target();
488-
489- forefather->do_draw(rt);
490-
491- rt.blit
492- (app->get_mouse_position() - Point(3, 7),
493- WLApplication::get()->is_mouse_pressed() ?
494- s_default_cursor_click :
495- s_default_cursor);
496-
497- forefather->do_tooltip();
498-
499- g_gr->refresh();
500- }
501+ RenderTarget& rt = *g_gr->get_render_target();
502+ forefather->do_draw(rt);
503+ rt.blit(app->get_mouse_position() - Point(3, 7),
504+ WLApplication::get()->is_mouse_pressed() ? s_default_cursor_click : s_default_cursor);
505+ forefather->do_tooltip();
506+ g_gr->refresh();
507
508 if (_flags & pf_child_die)
509 check_child_death();
510
511 // Wait until 1second/maxfps are over.
512- const uint32_t diffTime = SDL_GetTicks() - startTime;
513- if (diffTime < minTime) {
514- SDL_Delay(minTime - diffTime);
515+ const uint32_t frame_time = SDL_GetTicks() - startTime;
516+ if (frame_time < minimum_frame_time) {
517+ SDL_Delay(minimum_frame_time - frame_time);
518 }
519 }
520- g_gr->update();
521 end();
522
523 // Done
524@@ -242,8 +223,6 @@
525 if (nw == _w && nh == _h)
526 return;
527
528- int const upw = std::min(nw, _w);
529- int const uph = std::min(nh, _h);
530 _w = nw;
531 _h = nh;
532
533@@ -251,18 +230,14 @@
534 move_inside_parent();
535
536 layout();
537-
538- update(0, 0, upw, uph);
539 }
540
541 /**
542 * Move the panel. Panel's position is relative to the parent.
543 */
544 void Panel::set_pos(const Point n) {
545- update(0, 0, _w, _h);
546 _x = n.x;
547 _y = n.y;
548- update(0, 0, _w, _h);
549 }
550
551 /**
552@@ -383,7 +358,6 @@
553 _rborder = r;
554 _tborder = t;
555 _bborder = b;
556- update();
557 }
558
559 /**
560@@ -425,8 +399,6 @@
561 _flags &= ~pf_visible;
562 if (on)
563 _flags |= pf_visible;
564-
565- update(0, 0, _w, _h);
566 }
567
568 /**
569@@ -447,63 +419,6 @@
570 */
571 void Panel::draw_overlay(RenderTarget &) {}
572
573-
574-/**
575- * Mark a part of a panel for updating.
576- */
577-void Panel::update(int x, int y, int w, int h)
578-{
579- if
580- (x >= _w || x + w <= 0
581- ||
582- y >= _h || y + h <= 0)
583- return;
584-
585- if (_parent) {
586- _parent->update_inner(x + _x, y + _y, w, h);
587- } else {
588- if (x < 0) {
589- w += x;
590- x = 0;
591- }
592- if (x + w > g_gr->get_xres())
593- w = g_gr->get_xres() - x;
594- if (w <= 0)
595- return;
596-
597- if (y < 0) {
598- h += y;
599- y = 0;
600- }
601- if (y + h > g_gr->get_yres())
602- h = g_gr->get_yres() - y;
603- if (h <= 0)
604- return;
605-
606- g_gr->update();
607- }
608-}
609-
610-
611-/**
612- * Overload for convenience.
613- *
614- * Equivalent to update(0, 0, get_w(), get_h());
615- */
616-void Panel::update()
617-{
618- update(0, 0, get_w(), get_h());
619-}
620-
621-
622-/**
623- * Mark a part of a panel for updating.
624- */
625-void Panel::update_inner(int32_t x, int32_t y, int32_t w, int32_t h)
626-{
627- update(x - _lborder, y - _tborder, w, h);
628-}
629-
630 /**
631 * Called once per event loop pass, unless set_think(false) has
632 * been called. It is intended to be used for animations and game logic.
633@@ -627,7 +542,6 @@
634 while (p != _focus) {
635 if (p->get_can_focus()) {
636 p->focus();
637- p->update();
638 break;
639 }
640 if (p == _lchild) {
641@@ -1110,11 +1024,8 @@
642 return true;
643 }
644
645- Panel * p;
646- g_gr->update();
647-
648- p = ui_trackmouse(x, y);
649- if (!p)
650+ Panel* const p = ui_trackmouse(x, y);
651+ if (p == nullptr)
652 return false;
653
654 return p->do_mousemove(state, x, y, xdiff, ydiff);
655
656=== modified file 'src/ui_basic/panel.h'
657--- src/ui_basic/panel.h 2016-01-27 08:06:40 +0000
658+++ src/ui_basic/panel.h 2016-01-31 14:49:41 +0000
659@@ -186,9 +186,6 @@
660 virtual void draw (RenderTarget &);
661 virtual void draw_border (RenderTarget &);
662 virtual void draw_overlay(RenderTarget &);
663- void update(int32_t x, int32_t y, int32_t w, int32_t h);
664- void update();
665- void update_inner(int32_t x, int32_t y, int32_t w, int32_t h);
666
667 // Events
668 virtual void think();
669
670=== modified file 'src/ui_basic/progressbar.cc'
671--- src/ui_basic/progressbar.cc 2015-12-17 09:36:59 +0000
672+++ src/ui_basic/progressbar.cc 2016-01-31 14:49:41 +0000
673@@ -49,8 +49,6 @@
674 void ProgressBar::set_state(uint32_t state)
675 {
676 m_state = state;
677-
678- update();
679 }
680
681
682@@ -61,8 +59,6 @@
683 {
684 assert(total);
685 m_total = total;
686-
687- update();
688 }
689
690
691
692=== modified file 'src/ui_basic/progresswindow.cc'
693--- src/ui_basic/progresswindow.cc 2015-12-17 09:36:59 +0000
694+++ src/ui_basic/progresswindow.cc 2016-01-31 14:49:41 +0000
695@@ -89,7 +89,6 @@
696 m_background = "pics/progress.png";
697 }
698 draw_background(rt, g_gr->get_xres(), g_gr->get_yres());
699- update(true);
700 }
701
702 void ProgressWindow::step(const std::string & description) {
703@@ -106,13 +105,11 @@
704 UI::g_fh1->render(as_uifont(description, UI_FONT_SIZE_SMALL, PROGRESS_FONT_COLOR_FG)),
705 BlendMode::UseAlpha,
706 UI::Align::kCenter);
707- g_gr->update();
708
709 #ifdef _WIN32
710 // Pump events to prevent "not responding" on windows
711 SDL_PumpEvents();
712 #endif
713-
714 update(true);
715 }
716
717@@ -121,6 +118,7 @@
718 visualization->update(repaint); // let visualizations do their work
719 }
720 g_gr->refresh();
721+
722 }
723
724 /**
725
726=== modified file 'src/ui_basic/scrollbar.cc'
727--- src/ui_basic/scrollbar.cc 2016-01-17 20:04:07 +0000
728+++ src/ui_basic/scrollbar.cc 2016-01-31 14:49:41 +0000
729@@ -79,7 +79,6 @@
730 set_scrollpos(steps - 1);
731
732 m_steps = steps;
733- update();
734 }
735
736
737@@ -136,8 +135,6 @@
738
739 m_pos = pos;
740 moved(pos);
741-
742- update();
743 }
744
745
746@@ -428,7 +425,6 @@
747 default:
748 break;
749 }
750- update();
751 return result;
752 }
753 bool Scrollbar::handle_mouserelease(const uint8_t btn, int32_t, int32_t) {
754@@ -446,7 +442,6 @@
755 default:
756 break;
757 }
758- update();
759 return result;
760 }
761
762
763=== modified file 'src/ui_basic/slider.cc'
764--- src/ui_basic/slider.cc 2015-12-17 09:36:59 +0000
765+++ src/ui_basic/slider.cc 2016-01-31 14:49:41 +0000
766@@ -82,7 +82,6 @@
767 m_value = new_value;
768 calculate_cursor_position();
769 send_value_changed();
770- update();
771 }
772 }
773
774@@ -115,7 +114,6 @@
775 assert(m_min_value <= new_max);
776 if (m_max_value != new_max) {
777 calculate_cursor_position();
778- update();
779 }
780 m_max_value = new_max;
781 set_value(m_value);
782@@ -130,7 +128,6 @@
783 assert(m_max_value >= new_min);
784 if (m_min_value != new_min) {
785 calculate_cursor_position();
786- update();
787 }
788 m_min_value = new_min;
789 set_value(m_value);
790@@ -216,13 +213,11 @@
791 m_highlighted = false;
792 grab_mouse(false);
793 }
794- update();
795 }
796
797
798 /**
799- * Set whether the sliding button should be highlighted,
800- * and trigger a draw update when necessary.
801+ * Set whether the sliding button should be highlighted.
802 */
803 void Slider::set_highlighted(bool highlighted)
804 {
805@@ -230,7 +225,6 @@
806 return;
807
808 m_highlighted = highlighted;
809- update();
810 }
811
812
813@@ -260,8 +254,6 @@
814
815 // cursor position: align to integer value
816 calculate_cursor_position();
817-
818- update();
819 }
820 return true;
821 }
822@@ -275,8 +267,6 @@
823 * \param y The y position of the mouse pointer.
824 */
825 void Slider::cursor_moved(int32_t pointer, int32_t x, int32_t y) {
826- int32_t o_cursor_pos = m_cursor_pos;
827-
828 if (!m_enabled)
829 return;
830
831@@ -313,9 +303,6 @@
832 m_value = new_value;
833 send_value_changed();
834 }
835-
836- if (o_cursor_pos != m_cursor_pos)
837- update();
838 }
839
840
841@@ -334,8 +321,6 @@
842 m_relative_move = pointer - m_cursor_pos;
843
844 play_click();
845-
846- update();
847 }
848
849
850@@ -376,7 +361,6 @@
851 send_value_changed();
852
853 m_relative_move = ofs;
854- update();
855 }
856
857 void VerticalSlider::layout() {
858
859=== modified file 'src/ui_basic/table.cc'
860--- src/ui_basic/table.cc 2016-01-29 08:50:22 +0000
861+++ src/ui_basic/table.cc 2016-01-31 14:49:41 +0000
862@@ -448,7 +448,6 @@
863 if (column.is_checkbox_column) {
864 play_click();
865 m_entry_records.at(row)->toggle(col);
866- update(0, 0, get_eff_w(), get_h());
867 }
868 break;
869 }
870@@ -524,7 +523,6 @@
871 m_selection = i;
872
873 selected(m_selection);
874- update(0, 0, get_eff_w(), get_h());
875 }
876
877 /**
878@@ -551,8 +549,6 @@
879 select(m_entry_records.size() - 1);
880 m_scrollbar->set_scrollpos(std::numeric_limits<int32_t>::max());
881 }
882-
883- update(0, 0, get_eff_w(), get_h());
884 return result;
885 }
886
887@@ -562,8 +558,6 @@
888 void Table<void *>::set_scrollpos(int32_t const i)
889 {
890 m_scrollpos = i;
891-
892- update(0, 0, get_eff_w(), get_h());
893 }
894
895 /**
896@@ -631,8 +625,6 @@
897 newselection = i;
898 }
899 m_selection = newselection;
900-
901- update();
902 }
903
904 /**
905
906=== modified file 'src/ui_basic/tabpanel.cc'
907--- src/ui_basic/tabpanel.cc 2016-01-28 21:27:04 +0000
908+++ src/ui_basic/tabpanel.cc 2016-01-31 14:49:41 +0000
909@@ -385,7 +385,6 @@
910 void TabPanel::handle_mousein(bool inside)
911 {
912 if (!inside && highlight_ != kNotFound) {
913- update(tabs_[highlight_]->get_x(), 0, tabs_[highlight_]->get_w(), kTabPanelButtonHeight);
914 highlight_ = kNotFound;
915 }
916 }
917@@ -400,12 +399,6 @@
918 size_t hl = find_tab(x, y);
919
920 if (hl != highlight_) {
921- if (hl != kNotFound) {
922- update(tabs_[hl]->get_x(), 0, tabs_[hl]->get_w(), kTabPanelButtonHeight);
923- }
924- if (highlight_ != kNotFound) {
925- update(tabs_[highlight_]->get_x(), 0, tabs_[highlight_]->get_w(), kTabPanelButtonHeight);
926- }
927 highlight_ = hl;
928 set_tooltip(highlight_ != kNotFound ? tabs_[highlight_]->tooltip : "");
929 }
930
931=== modified file 'src/ui_basic/textarea.cc'
932--- src/ui_basic/textarea.cc 2016-01-28 21:27:04 +0000
933+++ src/ui_basic/textarea.cc 2016-01-31 14:49:41 +0000
934@@ -137,8 +137,6 @@
935 expand();
936 else if (m_layoutmode == Layouted)
937 update_desired_size();
938-
939- update();
940 }
941
942 const std::string& Textarea::get_text()
943
944=== modified file 'src/ui_basic/window.cc'
945--- src/ui_basic/window.cc 2016-01-28 21:27:04 +0000
946+++ src/ui_basic/window.cc 2016-01-31 14:49:41 +0000
947@@ -110,7 +110,6 @@
948 void Window::set_title(const string & text)
949 {
950 m_title = is_richtext(text) ? text : as_window_title(text);
951- update(0, 0, get_w(), TP_B_PIXMAP_THICKNESS);
952 }
953
954 /**
955
956=== modified file 'src/wui/game_message_menu.cc'
957--- src/wui/game_message_menu.cc 2016-01-28 21:27:04 +0000
958+++ src/wui/game_message_menu.cc 2016-01-31 14:49:41 +0000
959@@ -339,9 +339,6 @@
960 if (list->size()) {
961 if (!list->has_selection())
962 list->select(0);
963- // TODO(unknown): Workaround for bug #691928: There should
964- // be a solution without this extra update().
965- list->update();
966 } else {
967 centerviewbtn_->set_enabled(false);
968 message_body.set_text(std::string());
969
970=== modified file 'src/wui/game_summary.cc'
971--- src/wui/game_summary.cc 2016-01-28 21:27:04 +0000
972+++ src/wui/game_summary.cc 2016-01-31 14:49:41 +0000
973@@ -218,7 +218,6 @@
974 % static_cast<unsigned int>(teawon_)).str());
975 }
976 }
977- players_table_->update();
978 if (!players_status.empty()) {
979 players_table_->select(current_player_position);
980 }
981
982=== modified file 'src/wui/game_tips.cc'
983--- src/wui/game_tips.cc 2016-01-24 20:11:53 +0000
984+++ src/wui/game_tips.cc 2016-01-31 14:49:41 +0000
985@@ -119,6 +119,4 @@
986 Point center(tips_area.x + tips_area.w / 2, tips_area.y + tips_area.h / 2);
987 const Image* rendered_text = UI::g_fh1->render(as_game_tip(tips_[index].text), tips_area.w);
988 rt.blit(center - Point(rendered_text->width() / 2, rendered_text->height() / 2), rendered_text);
989-
990- g_gr->update();
991 }
992
993=== modified file 'src/wui/interactive_base.cc'
994--- src/wui/interactive_base.cc 2016-01-28 21:27:04 +0000
995+++ src/wui/interactive_base.cc 2016-01-31 14:49:41 +0000
996@@ -335,13 +335,8 @@
997 set_rel_viewpoint(Point (scrollval, 0), false);
998 }
999 }
1000-
1001 egbase().think(); // Call game logic here. The game advances.
1002
1003- // The entire screen needs to be redrawn (unit movement, tile animation,
1004- // etc...)
1005- g_gr->update();
1006-
1007 UI::Panel::think();
1008 }
1009
1010
1011=== modified file 'src/wui/itemwaresdisplay.cc'
1012--- src/wui/itemwaresdisplay.cc 2016-01-24 20:11:53 +0000
1013+++ src/wui/itemwaresdisplay.cc 2016-01-31 14:49:41 +0000
1014@@ -52,10 +52,7 @@
1015 */
1016 void ItemWaresDisplay::clear()
1017 {
1018- if (!items_.empty()) {
1019- items_.clear();
1020- update();
1021- }
1022+ items_.clear();
1023 }
1024
1025 /**
1026@@ -100,7 +97,6 @@
1027 it.worker = worker;
1028 it.index = index;
1029 items_.push_back(it);
1030- update();
1031 }
1032
1033 void ItemWaresDisplay::draw(RenderTarget & dst)
1034
1035=== modified file 'src/wui/mapview.cc'
1036--- src/wui/mapview.cc 2016-01-24 20:11:53 +0000
1037+++ src/wui/mapview.cc 2016-01-31 14:49:41 +0000
1038@@ -168,8 +168,6 @@
1039
1040 if (!intbase().get_sel_freeze())
1041 track_sel(Point(x, y));
1042-
1043- g_gr->update();
1044 return true;
1045 }
1046
1047
1048=== modified file 'src/wui/minimap.cc'
1049--- src/wui/minimap.cc 2016-01-24 20:11:53 +0000
1050+++ src/wui/minimap.cc 2016-01-31 14:49:41 +0000
1051@@ -54,8 +54,6 @@
1052 {
1053 viewx_ = x / TRIANGLE_WIDTH;
1054 viewy_ = y / TRIANGLE_HEIGHT;
1055-
1056- update();
1057 }
1058
1059
1060
1061=== modified file 'src/wui/productionsitewindow.cc'
1062--- src/wui/productionsitewindow.cc 2016-01-28 21:27:04 +0000
1063+++ src/wui/productionsitewindow.cc 2016-01-31 14:49:41 +0000
1064@@ -202,7 +202,6 @@
1065 continue;
1066 }
1067 }
1068- worker_table_->update();
1069 }
1070
1071 void ProductionSiteWindow::evict_worker() {
1072
1073=== modified file 'src/wui/soldierlist.cc'
1074--- src/wui/soldierlist.cc 2016-01-28 21:27:04 +0000
1075+++ src/wui/soldierlist.cc 2016-01-31 14:49:41 +0000
1076@@ -271,7 +271,6 @@
1077 if (changes) {
1078 Point mousepos = get_mouse_position();
1079 m_mouseover_fn(find_soldier(mousepos.x, mousepos.y));
1080- update();
1081 }
1082 }
1083
1084
1085=== modified file 'src/wui/waresdisplay.cc'
1086--- src/wui/waresdisplay.cc 2016-01-28 21:27:04 +0000
1087+++ src/wui/waresdisplay.cc 2016-01-31 14:49:41 +0000
1088@@ -260,7 +260,6 @@
1089 }
1090 }
1091 }
1092- update();
1093 }
1094
1095
1096@@ -273,10 +272,6 @@
1097
1098 void WaresDisplay::remove_all_warelists() {
1099 warelists_.clear();
1100- for (boost::signals2::connection& c : connections_)
1101- c.disconnect();
1102- connections_.clear();
1103- update();
1104 }
1105
1106
1107@@ -384,7 +379,6 @@
1108 return;
1109
1110 selected_[ware] = true;
1111- update();
1112 if (callback_function_)
1113 callback_function_(ware, true);
1114 }
1115@@ -395,7 +389,6 @@
1116 return;
1117
1118 selected_[ware] = false;
1119- update();
1120 if (callback_function_)
1121 callback_function_(ware, false);
1122 }
1123@@ -409,18 +402,14 @@
1124 {
1125 if (hidden_[ware])
1126 return;
1127-
1128 hidden_[ware] = true;
1129- update();
1130 }
1131
1132 void AbstractWaresDisplay::unhide_ware(Widelands::DescriptionIndex ware)
1133 {
1134 if (!hidden_[ware])
1135 return;
1136-
1137 hidden_[ware] = false;
1138- update();
1139 }
1140
1141 bool AbstractWaresDisplay::ware_hidden(Widelands::DescriptionIndex ware) {
1142@@ -463,9 +452,6 @@
1143 {
1144 // If you register something twice, it is counted twice. Not my problem.
1145 warelists_.push_back(&wares);
1146-
1147- connections_.push_back(wares.changed.connect(boost::bind(&WaresDisplay::update, boost::ref(*this))));
1148- update();
1149 }
1150
1151
1152
1153=== modified file 'src/wui/waresdisplay.h'
1154--- src/wui/waresdisplay.h 2016-01-24 20:11:53 +0000
1155+++ src/wui/waresdisplay.h 2016-01-31 14:49:41 +0000
1156@@ -22,8 +22,6 @@
1157
1158 #include <vector>
1159
1160-#include <boost/signals2.hpp>
1161-
1162 #include "logic/map_objects/tribes/tribe_descr.h"
1163 #include "logic/map_objects/tribes/warelist.h"
1164 #include "logic/map_objects/tribes/wareworker.h"
1165@@ -144,7 +142,6 @@
1166 private:
1167 using WareListVector = std::vector<const Widelands::WareList *>;
1168 WareListVector warelists_;
1169- std::vector<boost::signals2::connection> connections_;
1170 };
1171
1172 std::string waremap_to_richtext
1173
1174=== modified file 'src/wui/waresqueuedisplay.cc'
1175--- src/wui/waresqueuedisplay.cc 2016-01-24 20:11:53 +0000
1176+++ src/wui/waresqueuedisplay.cc 2016-01-31 14:49:41 +0000
1177@@ -52,7 +52,6 @@
1178 ware_type_(Widelands::wwWARE),
1179 max_fill_indicator_(g_gr->images().get(pic_max_fill_indicator)),
1180 cache_size_(queue->get_max_size()),
1181-cache_filled_(queue->get_filled()),
1182 cache_max_fill_(queue->get_max_fill()),
1183 total_height_(0),
1184 show_only_(show_only)
1185@@ -112,15 +111,11 @@
1186 if (static_cast<uint32_t>(queue_->get_max_size()) != cache_size_)
1187 max_size_changed();
1188
1189- if (static_cast<uint32_t>(queue_->get_filled()) != cache_filled_)
1190- update();
1191-
1192+ // TODO(sirver): It seems cache_max_fill_ is not really useful for anything.
1193 if (static_cast<uint32_t>(queue_->get_max_fill()) != cache_max_fill_) {
1194 cache_max_fill_ = queue_->get_max_fill();
1195 compute_max_fill_buttons_enabled_state();
1196- update();
1197 }
1198-
1199 }
1200
1201 /**
1202@@ -131,10 +126,9 @@
1203 if (!cache_size_)
1204 return;
1205
1206- cache_filled_ = queue_->get_filled();
1207 cache_max_fill_ = queue_->get_max_fill();
1208
1209- uint32_t nr_wares_to_draw = std::min(cache_filled_, cache_size_);
1210+ uint32_t nr_wares_to_draw = std::min(queue_->get_filled(), cache_size_);
1211 uint32_t nr_empty_to_draw = cache_size_ - nr_wares_to_draw;
1212
1213 Point point;
1214@@ -258,7 +252,6 @@
1215 increase_max_fill_->set_repeating(true);
1216 decrease_max_fill_->set_repeating(true);
1217 compute_max_fill_buttons_enabled_state();
1218-
1219 }
1220
1221 /**
1222
1223=== modified file 'src/wui/waresqueuedisplay.h'
1224--- src/wui/waresqueuedisplay.h 2016-01-24 20:11:53 +0000
1225+++ src/wui/waresqueuedisplay.h 2016-01-31 14:49:41 +0000
1226@@ -82,7 +82,6 @@
1227
1228
1229 uint32_t cache_size_;
1230- uint32_t cache_filled_;
1231 uint32_t cache_max_fill_;
1232 uint32_t total_height_;
1233 bool show_only_;

Subscribers

People subscribed via source and target branches

to status/vote changes: