windowscodecs: Implement IWICBitmap::CopyPixels.

This commit is contained in:
Vincent Povirk 2012-08-14 15:36:30 -05:00 committed by Alexandre Julliard
parent b31b9864d9
commit 54a3134194
2 changed files with 8 additions and 6 deletions

View File

@ -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);

View File

@ -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;