windowscodecs: Optimise copy_pixels in case the whole bitmap is copied.
Krzysztof Nowicki
krissn at op.pl
Tue Oct 19 14:51:25 CDT 2010
This small optimisation allows for copying the whole bitmap buffer in one go in
case the whole bitmap is copied and the strides of the buffers match.
---
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)
--
1.7.1
More information about the wine-patches
mailing list