Christian Costa : wined3d: Only copy memory corresponding to the dib section instead of the power of 2 surface .

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jul 14 10:51:02 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 494841d3e589041809adb5da54ac110dc7a4eaef
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=494841d3e589041809adb5da54ac110dc7a4eaef

Author: Christian Costa <titan.costa at wanadoo.fr>
Date:   Thu Jul 13 18:35:45 2006 +0200

wined3d: Only copy memory corresponding to the dib section instead of the power of 2 surface.

---

 dlls/wined3d/surface.c      |    5 +++--
 dlls/wined3d/wined3d_main.c |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index b86dd7b..b827fa8 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1021,17 +1021,18 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC
         if( (NP2_REPACK == wined3d_settings.nonpower2_mode || This->resource.usage & WINED3DUSAGE_RENDERTARGET)) {
             b_info->bmiHeader.biWidth = This->currentDesc.Width;
             b_info->bmiHeader.biHeight = -This->currentDesc.Height;
+            b_info->bmiHeader.biSizeImage = This->currentDesc.Width * This->currentDesc.Height * This->bytesPerPixel;
             /* Use the full pow2 image size(assigned below) because LockRect
              * will need it for a full glGetTexImage call
              */
         } else {
             b_info->bmiHeader.biWidth = This->pow2Width;
             b_info->bmiHeader.biHeight = -This->pow2Height;
+            b_info->bmiHeader.biSizeImage = This->resource.size;
         }
         b_info->bmiHeader.biPlanes = 1;
         b_info->bmiHeader.biBitCount = This->bytesPerPixel * 8;
 
-        b_info->bmiHeader.biSizeImage = This->resource.size;
 
         b_info->bmiHeader.biXPelsPerMeter = 0;
         b_info->bmiHeader.biYPelsPerMeter = 0;
@@ -1092,7 +1093,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDC
 
         /* copy the existing surface to the dib section */
         if(This->resource.allocatedMemory) {
-            memcpy(This->dib.bitmap_data, This->resource.allocatedMemory, This->resource.size);
+            memcpy(This->dib.bitmap_data, This->resource.allocatedMemory, b_info->bmiHeader.biSizeImage);
             /* We won't need that any more */
             HeapFree(GetProcessHeap(), 0, This->resource.allocatedMemory);
         } else {
diff --git a/dlls/wined3d/wined3d_main.c b/dlls/wined3d/wined3d_main.c
index 47733c8..9f984b0 100644
--- a/dlls/wined3d/wined3d_main.c
+++ b/dlls/wined3d/wined3d_main.c
@@ -191,7 +191,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, 
                 }
                 else if (!strcmp(buffer,"repack"))
                 {
-                    TRACE("Repacking non-power2 textre\n");
+                    TRACE("Repacking non-power2 textures\n");
                     wined3d_settings.nonpower2_mode = NP2_REPACK;
                 }
                 /* There will be a couple of other choices for nonpow2, they are: TextureRecrangle and OpenGL 2 */




More information about the wine-cvs mailing list