diff options
author | Chris Xiong <chirs241097@gmail.com> | 2018-02-03 23:43:31 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2018-02-03 23:43:31 +0800 |
commit | c741895e45968b50114a1b6ec0307503bce59783 (patch) | |
tree | 735dfe6bf02153dba22703dbe724f6c29f399603 /smelt/sdl | |
parent | 1eb88d4f5d5cb05d62be1d4a0c88c7399f7c0de0 (diff) | |
download | SMELT-c741895e45968b50114a1b6ec0307503bce59783.tar.xz |
Fixed texture locking for sure this time.
Diffstat (limited to 'smelt/sdl')
-rw-r--r-- | smelt/sdl/gfx_sdl.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
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;i<ptex->loch;++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;i<ptex->loch;++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 |