Module: wine Branch: refs/heads/master Commit: a7c2ab3e90c052b4b8945164a6f77d7c899253b5 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=a7c2ab3e90c052b4b8945164...
Author: Roderick Colenbrander thunderbird2k@gmx.net Date: Thu Aug 3 23:29:51 2006 +0200
wined3d: Surface pitch fix.
---
dlls/wined3d/surface.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 011ee4f..c6412de 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -1868,13 +1868,18 @@ static HRESULT WINAPI IWineD3DSurfaceImp d3dfmt_get_conv(This, TRUE /* We need color keying */, TRUE /* We will use textures */, &format, &internal, &type, &convert, &bpp);
if((convert != NO_CONVERSION) && This->resource.allocatedMemory) { - int width = This->glRect.right - This->glRect.left; int height = This->glRect.bottom - This->glRect.top; - int pitch = IWineD3DSurface_GetPitch(iface); + int pitch;
- mem = HeapAlloc(GetProcessHeap(), 0, width * height * bpp); + /* Set the pitch in 'length' not in bytes */ + if (NP2_REPACK == wined3d_settings.nonpower2_mode || This->resource.usage & WINED3DUSAGE_RENDERTARGET) + pitch = This->currentDesc.Width; + else + pitch = This->pow2Width; + + mem = HeapAlloc(GetProcessHeap(), 0, pitch * height * bpp); if(!mem) { - ERR("Out of memory %d, %d!\n", width, height); + ERR("Out of memory %d, %d!\n", pitch, height); return WINED3DERR_OUTOFVIDEOMEMORY; }
@@ -2005,6 +2010,7 @@ #endif This->resource.allocatedMemory = NULL; }
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); }
return WINED3D_OK;