Skip to content

Commit

Permalink
Fixed bug 3096 - SDL_BlitSurface with overlapping source and destination
Browse files Browse the repository at this point in the history
  • Loading branch information
kratz00 committed Oct 10, 2016
1 parent 564c790 commit aae28e3
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/video/SDL_blit_copy.c
Expand Up @@ -109,10 +109,20 @@ SDL_BlitCopy(SDL_BlitInfo * info)
overlap = (src < (dst + h*dstskip));
}
if (overlap) {
while (h--) {
SDL_memmove(dst, src, w);
src += srcskip;
dst += dstskip;
if ( dst < src ) {
while ( h-- ) {
SDL_memmove(dst, src, w);
src += srcskip;
dst += dstskip;
}
} else {
src += ((h-1) * srcskip);
dst += ((h-1) * dstskip);
while ( h-- ) {
SDL_memmove(dst, src, w);
src -= srcskip;
dst -= dstskip;
}
}
return;
}
Expand Down

0 comments on commit aae28e3

Please sign in to comment.