windowscodecs: Implement IWICBitmap::GetPixelFormat.
This commit is contained in:
parent
54a3134194
commit
f26402cad7
|
@ -43,6 +43,7 @@ typedef struct BitmapImpl {
|
||||||
UINT width, height;
|
UINT width, height;
|
||||||
UINT stride;
|
UINT stride;
|
||||||
UINT bpp;
|
UINT bpp;
|
||||||
|
WICPixelFormatGUID pixelformat;
|
||||||
} BitmapImpl;
|
} BitmapImpl;
|
||||||
|
|
||||||
typedef struct BitmapLockImpl {
|
typedef struct BitmapLockImpl {
|
||||||
|
@ -195,9 +196,10 @@ static HRESULT WINAPI BitmapLockImpl_GetDataPointer(IWICBitmapLock *iface,
|
||||||
static HRESULT WINAPI BitmapLockImpl_GetPixelFormat(IWICBitmapLock *iface,
|
static HRESULT WINAPI BitmapLockImpl_GetPixelFormat(IWICBitmapLock *iface,
|
||||||
WICPixelFormatGUID *pPixelFormat)
|
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 = {
|
static const IWICBitmapLockVtbl BitmapLockImpl_Vtbl = {
|
||||||
|
@ -272,9 +274,15 @@ static HRESULT WINAPI BitmapImpl_GetSize(IWICBitmap *iface,
|
||||||
static HRESULT WINAPI BitmapImpl_GetPixelFormat(IWICBitmap *iface,
|
static HRESULT WINAPI BitmapImpl_GetPixelFormat(IWICBitmap *iface,
|
||||||
WICPixelFormatGUID *pPixelFormat)
|
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,
|
static HRESULT WINAPI BitmapImpl_GetResolution(IWICBitmap *iface,
|
||||||
|
@ -446,6 +454,7 @@ HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight,
|
||||||
This->height = uiHeight;
|
This->height = uiHeight;
|
||||||
This->stride = stride;
|
This->stride = stride;
|
||||||
This->bpp = bpp;
|
This->bpp = bpp;
|
||||||
|
memcpy(&This->pixelformat, pixelFormat, sizeof(GUID));
|
||||||
|
|
||||||
*ppIBitmap = &This->IWICBitmap_iface;
|
*ppIBitmap = &This->IWICBitmap_iface;
|
||||||
|
|
||||||
|
|
|
@ -152,8 +152,8 @@ static void test_createbitmap(void)
|
||||||
base_lock_buffer = lock_buffer;
|
base_lock_buffer = lock_buffer;
|
||||||
|
|
||||||
hr = IWICBitmapLock_GetPixelFormat(lock, &pixelformat);
|
hr = IWICBitmapLock_GetPixelFormat(lock, &pixelformat);
|
||||||
todo_wine ok(hr == S_OK, "IWICBitmapLock_GetPixelFormat failed hr=%x\n", hr);
|
ok(hr == S_OK, "IWICBitmapLock_GetPixelFormat failed hr=%x\n", hr);
|
||||||
todo_wine ok(IsEqualGUID(&pixelformat, &GUID_WICPixelFormat24bppBGR), "unexpected pixel format\n");
|
ok(IsEqualGUID(&pixelformat, &GUID_WICPixelFormat24bppBGR), "unexpected pixel format\n");
|
||||||
|
|
||||||
hr = IWICBitmapLock_GetSize(lock, &width, &height);
|
hr = IWICBitmapLock_GetSize(lock, &width, &height);
|
||||||
ok(hr == S_OK, "IWICBitmapLock_GetSize failed hr=%x\n", hr);
|
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);
|
ok(lock_buffer == base_lock_buffer+6, "got %p, expected %p+6\n", lock_buffer, base_lock_buffer);
|
||||||
|
|
||||||
hr = IWICBitmapLock_GetPixelFormat(lock, &pixelformat);
|
hr = IWICBitmapLock_GetPixelFormat(lock, &pixelformat);
|
||||||
todo_wine ok(hr == S_OK, "IWICBitmapLock_GetPixelFormat failed hr=%x\n", hr);
|
ok(hr == S_OK, "IWICBitmapLock_GetPixelFormat failed hr=%x\n", hr);
|
||||||
todo_wine ok(IsEqualGUID(&pixelformat, &GUID_WICPixelFormat24bppBGR), "unexpected pixel format\n");
|
ok(IsEqualGUID(&pixelformat, &GUID_WICPixelFormat24bppBGR), "unexpected pixel format\n");
|
||||||
|
|
||||||
hr = IWICBitmapLock_GetSize(lock, &width, &height);
|
hr = IWICBitmapLock_GetSize(lock, &width, &height);
|
||||||
ok(hr == S_OK, "IWICBitmapLock_GetSize failed hr=%x\n", hr);
|
ok(hr == S_OK, "IWICBitmapLock_GetSize failed hr=%x\n", hr);
|
||||||
|
@ -239,11 +239,11 @@ static void test_createbitmap(void)
|
||||||
IWICBitmapLock_Release(lock);
|
IWICBitmapLock_Release(lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
todo_wine {
|
|
||||||
hr = IWICBitmap_GetPixelFormat(bitmap, &pixelformat);
|
hr = IWICBitmap_GetPixelFormat(bitmap, &pixelformat);
|
||||||
ok(hr == S_OK, "IWICBitmap_GetPixelFormat failed hr=%x\n", hr);
|
ok(hr == S_OK, "IWICBitmap_GetPixelFormat failed hr=%x\n", hr);
|
||||||
ok(IsEqualGUID(&pixelformat, &GUID_WICPixelFormat24bppBGR), "unexpected pixel format\n");
|
ok(IsEqualGUID(&pixelformat, &GUID_WICPixelFormat24bppBGR), "unexpected pixel format\n");
|
||||||
|
|
||||||
|
todo_wine {
|
||||||
hr = IWICBitmap_GetResolution(bitmap, &dpix, &dpiy);
|
hr = IWICBitmap_GetResolution(bitmap, &dpix, &dpiy);
|
||||||
ok(hr == S_OK, "IWICBitmap_GetResolution failed hr=%x\n", hr);
|
ok(hr == S_OK, "IWICBitmap_GetResolution failed hr=%x\n", hr);
|
||||||
ok(dpix == 0.0, "got %f, expected 0.0\n", dpix);
|
ok(dpix == 0.0, "got %f, expected 0.0\n", dpix);
|
||||||
|
|
Loading…
Reference in New Issue