windowscodecs: Implement IWICBitmap::GetPixelFormat.

This commit is contained in:
Vincent Povirk 2012-08-14 15:39:58 -05:00 committed by Alexandre Julliard
parent 54a3134194
commit f26402cad7
2 changed files with 18 additions and 9 deletions

View File

@ -43,6 +43,7 @@ typedef struct BitmapImpl {
UINT width, height;
UINT stride;
UINT bpp;
WICPixelFormatGUID pixelformat;
} BitmapImpl;
typedef struct BitmapLockImpl {
@ -195,9 +196,10 @@ static HRESULT WINAPI BitmapLockImpl_GetDataPointer(IWICBitmapLock *iface,
static HRESULT WINAPI BitmapLockImpl_GetPixelFormat(IWICBitmapLock *iface,
WICPixelFormatGUID *pPixelFormat)
{
FIXME("(%p,%p)\n", iface, pPixelFormat);
BitmapLockImpl *This = impl_from_IWICBitmapLock(iface);
TRACE("(%p,%p)\n", iface, pPixelFormat);
return E_NOTIMPL;
return IWICBitmap_GetPixelFormat(&This->parent->IWICBitmap_iface, pPixelFormat);
}
static const IWICBitmapLockVtbl BitmapLockImpl_Vtbl = {
@ -272,9 +274,15 @@ static HRESULT WINAPI BitmapImpl_GetSize(IWICBitmap *iface,
static HRESULT WINAPI BitmapImpl_GetPixelFormat(IWICBitmap *iface,
WICPixelFormatGUID *pPixelFormat)
{
FIXME("(%p,%p)\n", iface, pPixelFormat);
BitmapImpl *This = impl_from_IWICBitmap(iface);
TRACE("(%p,%p)\n", iface, pPixelFormat);
return E_NOTIMPL;
if (!pPixelFormat)
return E_INVALIDARG;
memcpy(pPixelFormat, &This->pixelformat, sizeof(GUID));
return S_OK;
}
static HRESULT WINAPI BitmapImpl_GetResolution(IWICBitmap *iface,
@ -446,6 +454,7 @@ HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight,
This->height = uiHeight;
This->stride = stride;
This->bpp = bpp;
memcpy(&This->pixelformat, pixelFormat, sizeof(GUID));
*ppIBitmap = &This->IWICBitmap_iface;

View File

@ -152,8 +152,8 @@ static void test_createbitmap(void)
base_lock_buffer = lock_buffer;
hr = IWICBitmapLock_GetPixelFormat(lock, &pixelformat);
todo_wine ok(hr == S_OK, "IWICBitmapLock_GetPixelFormat failed hr=%x\n", hr);
todo_wine ok(IsEqualGUID(&pixelformat, &GUID_WICPixelFormat24bppBGR), "unexpected pixel format\n");
ok(hr == S_OK, "IWICBitmapLock_GetPixelFormat failed hr=%x\n", hr);
ok(IsEqualGUID(&pixelformat, &GUID_WICPixelFormat24bppBGR), "unexpected pixel format\n");
hr = IWICBitmapLock_GetSize(lock, &width, &height);
ok(hr == S_OK, "IWICBitmapLock_GetSize failed hr=%x\n", hr);
@ -228,8 +228,8 @@ static void test_createbitmap(void)
ok(lock_buffer == base_lock_buffer+6, "got %p, expected %p+6\n", lock_buffer, base_lock_buffer);
hr = IWICBitmapLock_GetPixelFormat(lock, &pixelformat);
todo_wine ok(hr == S_OK, "IWICBitmapLock_GetPixelFormat failed hr=%x\n", hr);
todo_wine ok(IsEqualGUID(&pixelformat, &GUID_WICPixelFormat24bppBGR), "unexpected pixel format\n");
ok(hr == S_OK, "IWICBitmapLock_GetPixelFormat failed hr=%x\n", hr);
ok(IsEqualGUID(&pixelformat, &GUID_WICPixelFormat24bppBGR), "unexpected pixel format\n");
hr = IWICBitmapLock_GetSize(lock, &width, &height);
ok(hr == S_OK, "IWICBitmapLock_GetSize failed hr=%x\n", hr);
@ -239,11 +239,11 @@ static void test_createbitmap(void)
IWICBitmapLock_Release(lock);
}
todo_wine {
hr = IWICBitmap_GetPixelFormat(bitmap, &pixelformat);
ok(hr == S_OK, "IWICBitmap_GetPixelFormat failed hr=%x\n", hr);
ok(IsEqualGUID(&pixelformat, &GUID_WICPixelFormat24bppBGR), "unexpected pixel format\n");
todo_wine {
hr = IWICBitmap_GetResolution(bitmap, &dpix, &dpiy);
ok(hr == S_OK, "IWICBitmap_GetResolution failed hr=%x\n", hr);
ok(dpix == 0.0, "got %f, expected 0.0\n", dpix);