[wesnoth-commits] [wesnoth/wesnoth] ee35f6: Cleaned up various surface-related backend things

Charles Dang noreply at github.com
Mon Jul 22 04:39:22 UTC 2019


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: ee35f6ac9adf7285fed9219a4801602a5955869f
      https://github.com/wesnoth/wesnoth/commit/ee35f6ac9adf7285fed9219a4801602a5955869f
  Author: Charles Dang <exodia339 at gmail.com>
  Date:   2019-07-22 (Mon, 22 Jul 2019)

  Changed paths:
    M src/cursor.cpp
    M src/display.cpp
    M src/editor/action/mouse/mouse_action.cpp
    M src/editor/action/mouse/mouse_action_map_label.cpp
    M src/editor/action/mouse/mouse_action_village.cpp
    M src/editor/controller/editor_controller.cpp
    M src/editor/palette/item_palette.cpp
    M src/editor/palette/terrain_palettes.cpp
    M src/editor/palette/tristate_button.cpp
    M src/editor/palette/unit_palette.cpp
    M src/floating_label.cpp
    M src/font/sdl_ttf.cpp
    M src/font/text.cpp
    M src/font/text_surface.cpp
    M src/game_display.cpp
    M src/gui/core/canvas.cpp
    M src/gui/core/canvas.hpp
    M src/gui/dialogs/title_screen.cpp
    M src/halo.cpp
    M src/help/help_text_area.cpp
    M src/hotkey/command_executor.cpp
    M src/image_modifications.cpp
    M src/minimap.cpp
    M src/picture.cpp
    M src/sdl/surface.cpp
    M src/sdl/surface.hpp
    M src/sdl/utils.cpp
    M src/sdl/utils.hpp
    M src/tests/test_image_modifications.cpp
    M src/units/drawer.cpp
    M src/video.cpp
    M src/widgets/button.cpp
    M src/widgets/menu_style.cpp
    M src/widgets/scrollbar.cpp
    M src/widgets/textbox.cpp

  Log Message:
  -----------
  Cleaned up various surface-related backend things

* Removed create_neutral_surface in favor of a surface ctor that takes w/h dimensions.

* Removed make_neutral_surface in favor of a surface::make_neutral function. Most usecases of this were
  to make a copy of a surface anyway, so I added a new surface::clone function

* Moved the pixel format validation and conversion to the surface class. Now *all* surfaces should be
  guaranteed to be in the 'neutral' format. Any new surface that is created (with clone() or the dimension
  ctor will be in that format, and any time a raw SDL_Surface* ptr is assigned, it is also converted. This
  applies both to the ctor and assignment operators.

* Removed create_compatible_surface. All surfaces should be compatible in the first place.

* Removed surface::assign was in favor of simple assignment operators. The existing assignment operators
  already just called assign().

* Removed surface::null in favor of the implicit SDL_Surface* conversion operator for consistency. We were
  already using null and implicit pointer bool conversion, so I decided to go with the latter. I was going
  to add an operator bool(), but it was ambiguous in surface-to-surface comparisons.





More information about the Commits mailing list