[Commits] [wesnoth/wesnoth] 659498: Display: avoid unnecessarily (potentially) creatin...

GitHub noreply at github.com
Wed Jul 19 04:55:28 UTC 2017


  Branch: refs/heads/accelerated_rendering
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 65949873c393eaeeef8a28d0b65fe6d27ac4a44b
      https://github.com/wesnoth/wesnoth/commit/65949873c393eaeeef8a28d0b65fe6d27ac4a44b
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2017-07-19 (Wed, 19 Jul 2017)

  Changed paths:
    M src/display.cpp
    M src/display.hpp

  Log Message:
  -----------
  Display: avoid unnecessarily (potentially) creating millions of temp vectors

I've moved the terrain hex drawing code directly into draw_visible_hexes instead of relying on get_terrain_images
to return a vector of all the necessary images for each visible hex and then drawing them. Instead, we now draw
each hex's images immediately without any intermediary container.

With the old method, after about 10 to 15 seconds of drawing we had already allocated (and destroyed) almost 180,000
temporary vectors (a new one was created for each hex, twice per draw cycle). It's obvious how quickly that would add
up over a normal play session, and though in this case the performance hit for creating each vector was probably tiny,
creating them likely would have added up.


  Commit: 10ed114c531ad4e01e59b681561d607e6b7fad3e
      https://github.com/wesnoth/wesnoth/commit/10ed114c531ad4e01e59b681561d607e6b7fad3e
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2017-07-19 (Wed, 19 Jul 2017)

  Changed paths:
    M src/units/map.cpp
    M src/units/map.hpp

  Log Message:
  -----------
  Unit Map: added has_unit_at helper function

Just a small wrapper function to check whether a unit is present a certain location.


  Commit: b7260f60c73be02b83aec16f38f5e3650fcac3fe
      https://github.com/wesnoth/wesnoth/commit/b7260f60c73be02b83aec16f38f5e3650fcac3fe
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2017-07-19 (Wed, 19 Jul 2017)

  Changed paths:
    M src/actions/vision.cpp

  Log Message:
  -----------
  Comment out an unused parameter

Not sure if we'll need this again (perhaps to delay draws mid-action) so I'm not removing it yet.


  Commit: 0427a5547bd45fdaa60850c955b15707246a477a
      https://github.com/wesnoth/wesnoth/commit/0427a5547bd45fdaa60850c955b15707246a477a
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2017-07-19 (Wed, 19 Jul 2017)

  Changed paths:
    M src/floating_label.cpp
    M src/floating_label.hpp

  Log Message:
  -----------
  Added RAII helper struct to manage a floating label's lifetime


  Commit: 85b8718d819530d23d7a4e84ae0694184b333db6
      https://github.com/wesnoth/wesnoth/commit/85b8718d819530d23d7a4e84ae0694184b333db6
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2017-07-19 (Wed, 19 Jul 2017)

  Changed paths:
    M src/display.cpp
    M src/display.hpp
    M src/game_display.cpp
    M src/game_display.hpp
    M src/whiteboard/manager.cpp
    M src/whiteboard/move.cpp
    M src/whiteboard/recall.cpp
    M src/whiteboard/recruit.cpp

  Log Message:
  -----------
  Another large batch of progress, primarily in game_display

This is primarily focused on getting various areas of the game display drawing, such as footstep images
and the terrain defense indicators.

To facilitate the last, I've refactored draw_text_in_hex to utilize floating labels instead of drawing
to hex directly with surfaces. This probably isn't the most optimal solution, since labels are continuously
created and destroyed, but since their text is usually short and cached in the rendered text cache it
does for now.

Also includes some cleanup of deprecated functions in display, and slight reordering of drawing order of
certain elements.


  Commit: a57fa95600d7b8a8247ef9cba9ae0216890fd40f
      https://github.com/wesnoth/wesnoth/commit/a57fa95600d7b8a8247ef9cba9ae0216890fd40f
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2017-07-19 (Wed, 19 Jul 2017)

  Changed paths:
    M src/display.cpp

  Log Message:
  -----------
  Display: simplified a few things


Compare: https://github.com/wesnoth/wesnoth/compare/d841d57f6b0d...a57fa95600d7


More information about the Commits mailing list