Krzysztof Nowicki : windowscodecs: Optimise copy_pixels in case the whole bitmap is copied.

Alexandre Julliard julliard at winehq.org
Wed Oct 20 13:24:38 CDT 2010


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

Author: Krzysztof Nowicki <krissn at op.pl>
Date:   Tue Oct 19 21:51:25 2010 +0200

windowscodecs: Optimise copy_pixels in case the whole bitmap is copied.

---

 dlls/windowscodecs/main.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/dlls/windowscodecs/main.c b/dlls/windowscodecs/main.c
index 906ea16..6f37f5d 100644
--- a/dlls/windowscodecs/main.c
+++ b/dlls/windowscodecs/main.c
@@ -77,6 +77,13 @@ HRESULT copy_pixels(UINT bpp, const BYTE *srcbuffer,
     if ((dststride * rc->Height) > dstbuffersize)
         return E_INVALIDARG;
 
+    /* if the whole bitmap is copied and the buffer format matches then it's a matter of a single memcpy */
+    if (rc->X == 0 && rc->Y == 0 && rc->Width == srcwidth && rc->Height == srcheight && srcstride == dststride)
+    {
+        memcpy(dstbuffer, srcbuffer, srcstride * srcheight);
+        return S_OK;
+    }
+
     row_offset = rc->X * bpp;
 
     if (row_offset % 8 == 0)




More information about the wine-cvs mailing list