From c741895e45968b50114a1b6ec0307503bce59783 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Sat, 3 Feb 2018 23:43:31 +0800 Subject: Fixed texture locking for sure this time. --- smelt/sdl/gfx_sdl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'smelt/sdl') diff --git a/smelt/sdl/gfx_sdl.cpp b/smelt/sdl/gfx_sdl.cpp index ae50db2..875f103 100644 --- a/smelt/sdl/gfx_sdl.cpp +++ b/smelt/sdl/gfx_sdl.cpp @@ -538,11 +538,12 @@ void SMELT_IMPL::smTexutreUnlock(SMTEX tex) if(!ptex->locpx)return; if(!ptex->roloc) { - DWORD *src=ptex->locpx,*dst=ptex->px+((ptex->locy*ptex->rw)+ptex->locx); - for(int i=0;iloch;++i)//TODO: flip it... + DWORD *src=ptex->locpx+ptex->locw*(ptex->loch-1), + *dst=ptex->px+(((ptex->rh-ptex->locy-1)*ptex->rw)+ptex->locx); + for(int i=0;iloch;++i) { memcpy(dst,src,ptex->locw*sizeof(DWORD)); - dst+=ptex->rw;src+=ptex->locw; + dst-=ptex->rw;src-=ptex->locw; } if(ptex->lost)configTexture(ptex,ptex->rw,ptex->rh,ptex->px); else -- cgit v1.2.3