diff --git a/changelog b/changelog index 89b2865b7dc3..051420ae1a01 100644 --- a/changelog +++ b/changelog @@ -42,6 +42,7 @@ Version 1.13.0-dev: when wesnoth is running in debug mode (--debug command line flag). * Graphics: * Smooth unit movement over terrain with elevation (e.g. keeps/bridges) + * Fixed bug #22045: Only blit neutral surfaces. * Units: * Increased the experience requirement for the Rami from 32 to 39 * Increased the experience requirement for the Saree from 56 to 64 diff --git a/src/sdl_utils.cpp b/src/sdl_utils.cpp index e3125298c0f3..05eac4653413 100644 --- a/src/sdl_utils.cpp +++ b/src/sdl_utils.cpp @@ -1908,11 +1908,14 @@ surface create_compatible_surface(const surface &surf, int width, int height) return s; } -void blit_surface(const surface& src, +void blit_surface(const surface& surf, const SDL_Rect* srcrect, surface& dst, const SDL_Rect* dstrect) { - assert(src); + assert(surf); assert(dst); + assert(is_neutral(dst)); + + const surface& src = is_neutral(surf) ? surf : make_neutral_surface(surf); // Get the areas to blit SDL_Rect dst_rect = create_rect(0, 0, dst->w, dst->h); diff --git a/src/sdl_utils.hpp b/src/sdl_utils.hpp index c99e4efc37b1..002bcc4fa1cf 100644 --- a/src/sdl_utils.hpp +++ b/src/sdl_utils.hpp @@ -386,7 +386,7 @@ surface create_compatible_surface(const surface &surf, int width = -1, int heigh * The rectangles are const and will not be modified. * * @pre @p src contains a valid canvas. - * @pre @p dst contains a valid canvas. + * @pre @p dst contains a valid neutral canvas. * @pre The caller must make sure the @p src fits on the @p dst. * * @param src The surface to blit.