From 54a3134194cd2cdfd6ba3362a72bf571c33ea786 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Tue, 14 Aug 2012 15:36:30 -0500 Subject: [PATCH] windowscodecs: Implement IWICBitmap::CopyPixels. --- dlls/windowscodecs/bitmap.c | 8 +++++--- dlls/windowscodecs/tests/bitmap.c | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dlls/windowscodecs/bitmap.c b/dlls/windowscodecs/bitmap.c index 8a03c684e4b..0f93c76bdce 100644 --- a/dlls/windowscodecs/bitmap.c +++ b/dlls/windowscodecs/bitmap.c @@ -300,9 +300,11 @@ static HRESULT WINAPI BitmapImpl_CopyPalette(IWICBitmap *iface, static HRESULT WINAPI BitmapImpl_CopyPixels(IWICBitmap *iface, const WICRect *prc, UINT cbStride, UINT cbBufferSize, BYTE *pbBuffer) { - FIXME("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer); + BitmapImpl *This = impl_from_IWICBitmap(iface); + TRACE("(%p,%p,%u,%u,%p)\n", iface, prc, cbStride, cbBufferSize, pbBuffer); - return E_NOTIMPL; + return copy_pixels(This->bpp, This->data, This->width, This->height, + This->stride, prc, cbStride, cbBufferSize, pbBuffer); } static HRESULT WINAPI BitmapImpl_Lock(IWICBitmap *iface, const WICRect *prcLock, @@ -426,7 +428,7 @@ HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, datasize = stride * uiHeight; This = HeapAlloc(GetProcessHeap(), 0, sizeof(BitmapImpl)); - data = HeapAlloc(GetProcessHeap(), 0, datasize); + data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, datasize); if (!This || !data) { HeapFree(GetProcessHeap(), 0, This); diff --git a/dlls/windowscodecs/tests/bitmap.c b/dlls/windowscodecs/tests/bitmap.c index 4de485548fa..f772e0db8ae 100644 --- a/dlls/windowscodecs/tests/bitmap.c +++ b/dlls/windowscodecs/tests/bitmap.c @@ -85,7 +85,7 @@ static void test_createbitmap(void) /* pixel data is initially zeroed */ hr = IWICBitmap_CopyPixels(bitmap, NULL, 9, 27, returned_data); - todo_wine ok(hr == S_OK, "IWICBitmap_CopyPixels failed hr=%x\n", hr); + ok(hr == S_OK, "IWICBitmap_CopyPixels failed hr=%x\n", hr); for (i=0; i<27; i++) ok(returned_data[i] == 0, "returned_data[%i] == %i\n", i, returned_data[i]); @@ -193,10 +193,10 @@ static void test_createbitmap(void) /* test that the data we wrote is returned by CopyPixels */ hr = IWICBitmap_CopyPixels(bitmap, NULL, 9, 27, returned_data); - todo_wine ok(hr == S_OK, "IWICBitmap_CopyPixels failed hr=%x\n", hr); + ok(hr == S_OK, "IWICBitmap_CopyPixels failed hr=%x\n", hr); for (i=0; i<27; i++) - todo_wine ok(returned_data[i] == bitmap_data[i], "returned_data[%i] == %i\n", i, returned_data[i]); + ok(returned_data[i] == bitmap_data[i], "returned_data[%i] == %i\n", i, returned_data[i]); /* try a valid partial rect, and write mode */ rc.X = 2;