Fixed bug 3096 - SDL_BlitSurface with overlapping source and destination

This commit is contained in:
Steffen Pankratz 2016-10-10 18:28:05 +02:00
parent 564c790f33
commit aae28e3ec1
1 changed files with 14 additions and 4 deletions

View File

@ -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;
}