aboutsummaryrefslogtreecommitdiff
path: root/smelt
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2018-02-03 23:43:31 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2018-02-03 23:43:31 +0800
commitc741895e45968b50114a1b6ec0307503bce59783 (patch)
tree735dfe6bf02153dba22703dbe724f6c29f399603 /smelt
parent1eb88d4f5d5cb05d62be1d4a0c88c7399f7c0de0 (diff)
downloadSMELT-c741895e45968b50114a1b6ec0307503bce59783.tar.xz
Fixed texture locking for sure this time.
Diffstat (limited to 'smelt')
-rw-r--r--smelt/glfw/gfx_glfw.cpp2
-rw-r--r--smelt/glfw_m/gfx_glfw.cpp2
-rw-r--r--smelt/sdl/gfx_sdl.cpp7
3 files changed, 6 insertions, 5 deletions
diff --git a/smelt/glfw/gfx_glfw.cpp b/smelt/glfw/gfx_glfw.cpp
index 485760d..5586112 100644
--- a/smelt/glfw/gfx_glfw.cpp
+++ b/smelt/glfw/gfx_glfw.cpp
@@ -538,7 +538,7 @@ void SMELT_IMPL::smTexutreUnlock(SMTEX tex)
if(!ptex->locpx)return;
if(!ptex->roloc)
{
- DWORD *src=ptex->locpx+ptex->locw*ptex->loch,
+ 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)
{
diff --git a/smelt/glfw_m/gfx_glfw.cpp b/smelt/glfw_m/gfx_glfw.cpp
index ebd24bf..41b4d7b 100644
--- a/smelt/glfw_m/gfx_glfw.cpp
+++ b/smelt/glfw_m/gfx_glfw.cpp
@@ -534,7 +534,7 @@ void SMELT_IMPL::smTexutreUnlock(SMTEX tex)
if(!ptex->locpx)return;
if(!ptex->roloc)
{
- DWORD *src=ptex->locpx+ptex->locw*ptex->loch,
+ 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)
{
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