Tony Wasserka : d3dx9: Black out pixels which are outside the source rect in D3DXLoadSurfaceFromMemory if no stretching is used .

Alexandre Julliard julliard at winehq.org
Mon Aug 23 10:50:19 CDT 2010


Module: wine
Branch: master
Commit: 18b891694266435edfeece184ab7cecf3d59f56b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=18b891694266435edfeece184ab7cecf3d59f56b

Author: Tony Wasserka <tony.wasserka at freenet.de>
Date:   Sat Aug 21 12:54:38 2010 +0200

d3dx9: Black out pixels which are outside the source rect in D3DXLoadSurfaceFromMemory if no stretching is used.

---

 dlls/d3dx9_36/surface.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c
index 487f06f..ca4fd25 100644
--- a/dlls/d3dx9_36/surface.c
+++ b/dlls/d3dx9_36/surface.c
@@ -526,6 +526,7 @@ static void make_argb_color(CONST struct argb_conversion_info *info, CONST DWORD
  *
  * Copies the source buffer to the destination buffer, performing
  * any necessary format conversion and color keying.
+ * Pixels outsize the source rect are blacked out.
  * Works only for ARGB formats with 1 - 4 bytes per pixel.
  */
 static void copy_simple_data(CONST BYTE *src,  UINT  srcpitch, POINT  srcsize, CONST PixelFormatDesc  *srcformat,
@@ -555,8 +556,12 @@ static void copy_simple_data(CONST BYTE *src,  UINT  srcpitch, POINT  srcsize, C
             srcptr  +=  srcformat->bytes_per_pixel;
             destptr += destformat->bytes_per_pixel;
         }
+
+        if(srcsize.x < destsize.x) /* black out remaining pixels */
+            ZeroMemory(destptr, destformat->bytes_per_pixel * (destsize.x - srcsize.x));
     }
-    /* TODO: Black out unused pixels */
+    if(srcsize.y < destsize.y) /* black out remaining pixels */
+        ZeroMemory(dest + srcsize.y * destpitch, destpitch * (destsize.y - srcsize.y));
 }
 
 /************************************************************




More information about the wine-cvs mailing list