wined3d: Fix UpdateSurface for sourceRect != sourceWidth

Fabian Bieler der.fabe at gmx.net
Wed Apr 4 17:40:38 CDT 2007


-------------- next part --------------
From baa9c9907f06a79964167dd73f51f5713da91dd8 Mon Sep 17 00:00:00 2001
From: Fabian Bieler <der.fabe at gmx.net>
Date: Sat, 31 Mar 2007 13:01:48 +0200
Subject: [PATCH] wined3d: Fix UpdateSurface for sourceRect != sourceWidth

---
 dlls/wined3d/device.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 3bee323..d1224e4 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4823,14 +4823,14 @@ static HRESULT  WINAPI  IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
     /* This function doesn't support compressed textures
     the pitch is just bytesPerPixel * width */
     if(srcWidth != srcSurfaceWidth  || srcLeft ){
-        rowoffset = (srcSurfaceWidth - srcWidth) * pSrcSurface->bytesPerPixel;
+        rowoffset = srcSurfaceWidth * pSrcSurface->bytesPerPixel;
         offset   += srcLeft * pSrcSurface->bytesPerPixel;
         /* TODO: do we ever get 3bpp?, would a shift and an add be quicker than a mul (well maybe a cycle or two) */
     }
     /* TODO DXT formats */
 
     if(pSourceRect != NULL && pSourceRect->top != 0){
-       offset +=  pSourceRect->top * srcWidth * pSrcSurface->bytesPerPixel;
+       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
-- 
1.4.4.1



More information about the wine-patches mailing list