[1/5] windowscodecs: Implement IWICBitmap::CopyPixels.

Vincent Povirk madewokherd at gmail.com
Thu Aug 16 10:47:52 CDT 2012


-------------- next part --------------
From 7b2552aa3121e222f4958d1a551865eb7f93e2e9 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Tue, 14 Aug 2012 15:36:30 -0500
Subject: [PATCH 1/7] 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 8a03c68..0f93c76 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 4de4855..f772e0d 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;
-- 
1.7.9.5


More information about the wine-patches mailing list