Skip to content

Commit

Permalink
Only blit neutral surfaces.
Browse files Browse the repository at this point in the history
On the Mac loaded images are not in the neutral format causing rendering
glitches when using blit_surface using these images. Test and when
needed convert the image before using it.

Fixes bug #22045.
  • Loading branch information
mordante committed May 18, 2014
1 parent bf1dbe2 commit ede743d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/sdl_utils.cpp
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/sdl_utils.hpp
Expand Up @@ -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.
Expand Down

0 comments on commit ede743d

Please sign in to comment.