diff --git a/src/display.cpp b/src/display.cpp index 6f397159077..8c453daf97a 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -19,6 +19,7 @@ */ #include "arrow.hpp" +#include "color.hpp" #include "cursor.hpp" #include "display.hpp" #include "draw.hpp" @@ -28,6 +29,7 @@ #include "font/text.hpp" #include "preferences/game.hpp" #include "gettext.hpp" +#include "gui/dialogs/loading_screen.hpp" #include "halo.hpp" #include "hotkey/command_executor.hpp" #include "language.hpp" @@ -39,7 +41,8 @@ #include "play_controller.hpp" //note: this can probably be refactored out #include "reports.hpp" #include "resources.hpp" -#include "color.hpp" +#include "sdl/utils.hpp" // fill_surface_rect +#include "show_dialog.hpp" #include "synced_context.hpp" #include "team.hpp" #include "terrain/builder.hpp" @@ -51,8 +54,6 @@ #include "units/drawer.hpp" #include "units/orb_status.hpp" #include "whiteboard/manager.hpp" -#include "show_dialog.hpp" -#include "gui/dialogs/loading_screen.hpp" #include diff --git a/src/display.hpp b/src/display.hpp index 738471e47c2..0fddca1b0eb 100644 --- a/src/display.hpp +++ b/src/display.hpp @@ -849,7 +849,7 @@ public: void render_image(int x, int y, const display::drawing_layer drawing_layer, const map_location& loc, const image::locator& i_locator, bool hreverse=false, bool greyscale=false, - int32_t alpha=floating_to_fixed_point(1.0), color_t blendto = {0,0,0}, + int32_t alpha=SDL_ALPHA_OPAQUE, color_t blendto = {0,0,0}, double blend_ratio=0, double submerged=0.0,bool vreverse =false); /** diff --git a/src/draw.cpp b/src/draw.cpp index 8798cb7cdc4..32fe4f05fa8 100644 --- a/src/draw.cpp +++ b/src/draw.cpp @@ -19,6 +19,7 @@ #include "sdl/rect.hpp" #include "sdl/surface.hpp" #include "sdl/texture.hpp" +#include "sdl/utils.hpp" // sdl::runtime_at_least #include "video.hpp" #include diff --git a/src/floating_label.cpp b/src/floating_label.cpp index 4b063323955..44423932eff 100644 --- a/src/floating_label.cpp +++ b/src/floating_label.cpp @@ -19,6 +19,7 @@ #include "draw.hpp" #include "font/text.hpp" #include "log.hpp" +#include "sdl/utils.hpp" #include "video.hpp" #include diff --git a/src/game_display.cpp b/src/game_display.cpp index 3c894ec2716..6eefc35cd0c 100644 --- a/src/game_display.cpp +++ b/src/game_display.cpp @@ -37,6 +37,7 @@ #include "font/standard_colors.hpp" #include "reports.hpp" #include "resources.hpp" +#include "sdl/utils.hpp" #include "tod_manager.hpp" #include "color.hpp" #include "synced_context.hpp" diff --git a/src/gui/core/canvas.cpp b/src/gui/core/canvas.cpp index eea8fca2b7f..e7dce31ef9e 100644 --- a/src/gui/core/canvas.cpp +++ b/src/gui/core/canvas.cpp @@ -34,6 +34,7 @@ #include "sdl/point.hpp" #include "sdl/rect.hpp" #include "sdl/texture.hpp" +#include "sdl/utils.hpp" // blur_surface #include "video.hpp" #include "wml_exception.hpp" diff --git a/src/gui/dialogs/campaign_difficulty.cpp b/src/gui/dialogs/campaign_difficulty.cpp index b24938f9702..627455a6126 100644 --- a/src/gui/dialogs/campaign_difficulty.cpp +++ b/src/gui/dialogs/campaign_difficulty.cpp @@ -18,15 +18,16 @@ #include "gui/dialogs/campaign_difficulty.hpp" #include "config.hpp" +#include "deprecation.hpp" #include "font/text_formatting.hpp" #include "formatter.hpp" +#include "game_version.hpp" #include "gui/auxiliary/find_widget.hpp" -#include "preferences/game.hpp" #include "gui/widgets/listbox.hpp" #include "gui/widgets/window.hpp" #include "log.hpp" +#include "preferences/game.hpp" #include "serialization/string_utils.hpp" -#include "deprecation.hpp" static lg::log_domain log_wml("wml"); #define WRN_WML LOG_STREAM(warn, log_wml) diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index 6eabe4d59b9..3853b99a099 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -27,6 +27,7 @@ #include "sdl/rect.hpp" #include "sound.hpp" #include "gettext.hpp" +#include "utils/math.hpp" #include "wml_exception.hpp" #include diff --git a/src/minimap.cpp b/src/minimap.cpp index a5d08ec6c50..d8b453e4e8a 100644 --- a/src/minimap.cpp +++ b/src/minimap.cpp @@ -28,6 +28,7 @@ #include "preferences/general.hpp" #include "resources.hpp" #include "sdl/surface.hpp" +#include "sdl/utils.hpp" #include "team.hpp" #include "terrain/type_data.hpp" #include "units/unit.hpp" diff --git a/src/sdl/rect.cpp b/src/sdl/rect.cpp index e70194a9a80..6ebc2a540f7 100644 --- a/src/sdl/rect.cpp +++ b/src/sdl/rect.cpp @@ -18,6 +18,8 @@ #include "sdl/window.hpp" #include "video.hpp" +#include + namespace sdl { bool point_in_rect(int x, int y, const SDL_Rect& rect) diff --git a/src/sdl/rect.hpp b/src/sdl/rect.hpp index e07fbc1769c..f1a307d9ac4 100644 --- a/src/sdl/rect.hpp +++ b/src/sdl/rect.hpp @@ -20,12 +20,10 @@ * Contains the SDL_Rect helper code. */ -#include "utils.hpp" +#include "sdl/point.hpp" #include -struct point; - namespace sdl { @@ -89,18 +87,6 @@ SDL_Rect intersect_rects(const SDL_Rect& rect1, const SDL_Rect& rect2); */ SDL_Rect union_rects(const SDL_Rect &rect1, const SDL_Rect &rect2); -/** - * Fill a rectangle on a given surface. Alias for SDL_FillRect. - * - * @param dst The surface to operate on. - * @param dst_rect The rectangle to fill. - * @param color Color of the rectangle. - */ -inline void fill_surface_rect(surface& dst, SDL_Rect* dst_rect, const uint32_t color) -{ - SDL_FillRect(dst, dst_rect, color); -} - } // namespace sdl bool operator==(const SDL_Rect& a, const SDL_Rect& b); diff --git a/src/sdl/surface.cpp b/src/sdl/surface.cpp index 0caf0337d19..f2c07b72777 100644 --- a/src/sdl/surface.cpp +++ b/src/sdl/surface.cpp @@ -14,6 +14,7 @@ #include "sdl/surface.hpp" +#include "color.hpp" #include "draw.hpp" // for surface_restorer. Remove that then remove this. #include "sdl/rect.hpp" #include "video.hpp" // for surface_restorer. Remove that then remove this. diff --git a/src/sdl/utils.hpp b/src/sdl/utils.hpp index fa444de0850..96487e44db3 100644 --- a/src/sdl/utils.hpp +++ b/src/sdl/utils.hpp @@ -39,6 +39,18 @@ version_info get_version(); */ bool runtime_at_least(uint8_t major, uint8_t minor = 0, uint8_t patch = 0); +/** + * Fill a rectangle on a given surface. Alias for SDL_FillRect. + * + * @param dst The surface to operate on. + * @param dst_rect The rectangle to fill. + * @param color Color of the rectangle. + */ +inline void fill_surface_rect(surface& dst, SDL_Rect* dst_rect, const uint32_t color) +{ + SDL_FillRect(dst, dst_rect, color); +} + } // namespace sdl diff --git a/src/show_dialog.cpp b/src/show_dialog.cpp index e830652509e..30204a050b3 100644 --- a/src/show_dialog.cpp +++ b/src/show_dialog.cpp @@ -29,6 +29,7 @@ #include "font/standard_colors.hpp" #include "sdl/rect.hpp" #include "sdl/input.hpp" // get_mouse_state +#include "sdl/utils.hpp" // blur_surface static lg::log_domain log_display("display"); #define ERR_DP LOG_STREAM(err, log_display) diff --git a/src/units/drawer.cpp b/src/units/drawer.cpp index f66bb1592d0..ad36d0e8d34 100644 --- a/src/units/drawer.cpp +++ b/src/units/drawer.cpp @@ -26,6 +26,7 @@ #include "picture.hpp" #include "preferences/game.hpp" #include "sdl/surface.hpp" +#include "sdl/utils.hpp" // scale_surface_nn, fill_surface_rect #include "team.hpp" #include "units/animation.hpp" #include "units/animation_component.hpp" diff --git a/src/units/frame.cpp b/src/units/frame.cpp index e9149e4388d..521be8ebd07 100644 --- a/src/units/frame.cpp +++ b/src/units/frame.cpp @@ -18,6 +18,7 @@ #include "color.hpp" #include "game_display.hpp" #include "log.hpp" +#include "sdl/utils.hpp" // floating_to_fixed_point #include "sound.hpp" static lg::log_domain log_engine("engine");