wined3d: Properly handle the offset for compressed surfaces in IWineD3DDeviceImpl_UpdateSurface().
Henri Verbeet
hverbeet at codeweavers.com
Wed Sep 24 08:56:48 CDT 2008
---
dlls/wined3d/device.c | 38 ++++++++------------------------------
1 files changed, 8 insertions(+), 30 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 1a99b31..409c7a1 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5902,17 +5902,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
if(pSourceRect != NULL && pSourceRect->top != 0){
offset += pSourceRect->top * srcSurfaceWidth * pSrcSurface->bytesPerPixel;
}
- TRACE("(%p) glTexSubImage2D, Level %d, left %d, top %d, width %d, height %d , ftm %d, type %d, memory %p\n"
- ,This
- ,glDescription->level
- ,destLeft
- ,destTop
- ,srcWidth
- ,srcHeight
- ,glDescription->glFormat
- ,glDescription->glType
- ,IWineD3DSurface_GetData(pSourceSurface)
- );
+ TRACE("(%p) glTexSubImage2D, level %d, left %d, top %d, width %d, height %d, fmt %#x, type %#x, memory %p+%#x\n",
+ This, glDescription->level, destLeft, destTop, srcWidth, srcHeight, glDescription->glFormat,
+ glDescription->glType, IWineD3DSurface_GetData(pSourceSurface), offset);
/* Sanity check */
if (IWineD3DSurface_GetData(pSourceSurface) == NULL) {
@@ -5945,6 +5937,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
}
} else { /* Full width, so just write out the whole texture */
+ const unsigned char* data = ((const unsigned char *)IWineD3DSurface_GetData(pSourceSurface)) + offset;
if (WINED3DFMT_DXT1 == destFormat ||
WINED3DFMT_DXT2 == destFormat ||
@@ -5958,14 +5951,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
} if (destFormat != srcFormat) {
FIXME("Updating mixed format compressed texture is not curretly support\n");
} else {
- GL_EXTCALL(glCompressedTexImage2DARB)(glDescription->target,
- glDescription->level,
- glDescription->glFormatInternal,
- srcWidth,
- srcHeight,
- 0,
- destSize,
- IWineD3DSurface_GetData(pSourceSurface));
+ GL_EXTCALL(glCompressedTexImage2DARB(glDescription->target, glDescription->level,
+ glDescription->glFormatInternal, srcWidth, srcHeight, 0, destSize, data));
}
} else {
FIXME("Attempting to update a DXT compressed texture without hardware support\n");
@@ -5973,17 +5960,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
} else {
- const unsigned char* data =((const unsigned char *)IWineD3DSurface_GetData(pSourceSurface)) + offset;
- glTexSubImage2D(glDescription->target
- ,glDescription->level
- ,destLeft
- ,destTop
- ,srcWidth
- ,srcHeight
- ,glDescription->glFormat
- ,glDescription->glType
- ,data
- );
+ glTexSubImage2D(glDescription->target, glDescription->level, destLeft, destTop,
+ srcWidth, srcHeight, glDescription->glFormat, glDescription->glType, data);
}
}
checkGLcall("glTexSubImage2D");
--
1.5.6.4
--------------090709020909060605040903--
More information about the wine-patches
mailing list