I found blit error after calling SDL_BlitSurface. In detail, when src and
dst are same surface, and start pixel pointer of src_rect is less than start
pixel of dst_rect, and src_rect overlapps dst_rect, SDL_BlitSurface results
to only some top lines right, other bottom lines display error.
Track logic of SDL_BlitCopy, I think SDL_BlitCopy results to it.
…
if (overlap) {
while (h--) {
SDL_memmove(dst, src, w);
src += srcskip;
dst += dstskip;
}
return;
}
…
In that case, overlap is true, then execute while loop.
For example, line#0 of src is copied to line#0 of dst, but src and dst are
same surface, line#0 of dst is line#2 of src in fact. It will only copy data
of line#0-#2 to dst repeatly!
I attempt to modify above code:
…
if (overlap) {
if (src > dst) {
while (h--) {
SDL_memmove(dst, src, w);
src += srcskip;
dst += dstskip;
}
} else if (src < dst) {
src += (h - 1) * srcskip;
dst += (h - 1) * dstskip;
while (h --) {
SDL_memmove(dst, src, w);
src -= srcskip;
dst -= dstskip;
}
}
return;
}
…
Is it BUG or not in SDL_BlitCopy?