Module: wine Branch: master Commit: 3bb1ea3d34bc69a575b0418da89aabfe7e51fe32 URL: http://source.winehq.org/git/wine.git/?a=commit;h=3bb1ea3d34bc69a575b0418da8...
Author: Luis Javier Merino ninjalj@gmail.com Date: Wed Mar 19 03:44:37 2008 +0100
wined3d: BltFast dealing correctly with overlapping src and dest.
---
dlls/wined3d/surface_base.c | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/surface_base.c b/dlls/wined3d/surface_base.c index babb49f..14de5a5 100644 --- a/dlls/wined3d/surface_base.c +++ b/dlls/wined3d/surface_base.c @@ -1613,13 +1613,28 @@ IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, else { int width = w * bpp; + INT sbufpitch, dbufpitch; + TRACE("NO color key copy\n"); + /* Handle overlapping surfaces */ + if (sbuf < dbuf) + { + sbuf += (h - 1) * slock.Pitch; + dbuf += (h - 1) * dlock.Pitch; + sbufpitch = -slock.Pitch; + dbufpitch = -dlock.Pitch; + } + else + { + sbufpitch = slock.Pitch; + dbufpitch = dlock.Pitch; + } for (y = 0; y < h; y++) { /* This is pretty easy, a line for line memcpy */ - memcpy(dbuf, sbuf, width); - sbuf += slock.Pitch; - dbuf += dlock.Pitch; + memmove(dbuf, sbuf, width); + sbuf += sbufpitch; + dbuf += dbufpitch; } TRACE("Copy done\n"); }