diff --git a/dlls/d3d8/drawprim.c b/dlls/d3d8/drawprim.c index 54bfadb6871..86811321500 100644 --- a/dlls/d3d8/drawprim.c +++ b/dlls/d3d8/drawprim.c @@ -1487,7 +1487,7 @@ void drawPrimitive(LPDIRECT3DDEVICE8 iface, TRACE("Saving texture %s (Format:%s)\n", buffer, debug_d3dformat(((IDirect3DBaseTexture8Impl *)This->StateBlock->textures[textureNo])->format)); IDirect3DTexture8Impl_GetSurfaceLevel((LPDIRECT3DTEXTURE8) This->StateBlock->textures[textureNo], 0, &pSur); IDirect3DSurface8Impl_SaveSnapshot(pSur, buffer); - IDirect3DSurface8Impl_ReleaseRef(pSur); + IDirect3DSurface8Impl_Release(pSur); } } } diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c index 14589287cf9..246c97870f4 100644 --- a/dlls/d3d8/surface.c +++ b/dlls/d3d8/surface.c @@ -152,10 +152,16 @@ HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D3DLOCKE TRACE("(%p) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->allocatedMemory); } - pLockedRect->Pitch = This->bytesPerPixel * This->myDesc.Width; /* Bytes / row */ - if (This->myDesc.Format == D3DFMT_DXT1) /* DXT1 is half byte per pixel */ - pLockedRect->Pitch = pLockedRect->Pitch/2; - + /* DXTn formats dont have exact pitches as they are to the newt row of blocks, + where each block is 4x4 pixels, 8 bytes (dxt1) and 16 bytes (dxt3/5) + ie pitch = (width/4) * bytes per block */ + if (This->myDesc.Format == D3DFMT_DXT1) /* DXT1 is 8 bytes per block */ + pLockedRect->Pitch = (This->myDesc.Width/4) * 8; + else if (This->myDesc.Format == D3DFMT_DXT3 || This->myDesc.Format == D3DFMT_DXT5) /* DXT3/5 is 16 bytes per block */ + pLockedRect->Pitch = (This->myDesc.Width/4) * 16; + else + pLockedRect->Pitch = This->bytesPerPixel * This->myDesc.Width; /* Bytes / row */ + if (NULL == pRect) { pLockedRect->pBits = This->allocatedMemory; This->lockedRect.left = 0;