[Commits] [wesnoth/wesnoth] cd0d27: Refactored handling of window/renderer size getter...

GitHub noreply at github.com
Fri Jul 21 20:48:06 UTC 2017


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

  Changed paths:
    M src/controller_base.cpp
    M src/display.cpp
    M src/display.hpp
    M src/events.cpp
    M src/floating_label.cpp
    M src/gui/dialogs/lobby/lobby.cpp
    M src/gui/widgets/window.cpp
    M src/help/help.cpp
    M src/help/help_topic_generators.cpp
    M src/show_dialog.cpp
    M src/tooltips.cpp
    M src/video.cpp
    M src/video.hpp
    M src/widgets/button.cpp
    M src/widgets/menu.cpp
    M src/widgets/textbox.cpp

  Log Message:
  -----------
  Refactored handling of window/renderer size getters

* Removed display::screen_area(), display::w(), and display::h().
* Moved the global screen_area() function into the CVideo class.
* Renamed CVideo::getx() and gety() to get_width() and get_height()
* Made those two functions return the result of screen_area() instead of the other way around.
* Added preliminary support for high-DPI rendering to screen_area()

Note on the last point: When I fixed bug #1772 (aa8f6c7e7 right now but will probably change with rebasing)
I noted that SDL_GetWindowSize and SDL_GetRendererOutputSize returned the same results for me (even with
Window's automatic scaling for non-high-DPI-enabled apps disabled) but that the SDL documentation stated the
former returned screen coordinates and the latter pixels. In that same commit I changed the dimension functions
to use SDL_GetWindowSize. I've now reversed that decision and gone back to using SDL_GetRendererOutputSize so
I can guarantee output in pixels. If use_pixels is false, the code will return coordinates in 96 DPI, so I need
to have pixel measurements for the calculations.

Again, though, I do not know if SDL_GetWindowSize returns a different value that pixel size (which it's said
to do) on macOS or iOS. I'll need to do some testing. It's possible on those platforms I won't need the 96 DPI
measurements, but it's also possible it will be needed on on platforms, since all of our code relies on pixel
measurements.





More information about the Commits mailing list