Commit 54a31341 authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

windowscodecs: Implement IWICBitmap::CopyPixels.

parent b31b9864
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment