dwrite: Implement IDWriteBitmapRenderTarget_GetSize.

This commit is contained in:
Nikolay Sivov 2012-08-13 07:51:38 +04:00 committed by Alexandre Julliard
parent 292fd912c9
commit c843e71ba5
2 changed files with 24 additions and 2 deletions

View File

@ -36,6 +36,7 @@ struct rendertarget {
IDWriteBitmapRenderTarget IDWriteBitmapRenderTarget_iface;
LONG ref;
SIZE size;
HDC hdc;
};
@ -135,8 +136,10 @@ static HRESULT WINAPI rendertarget_SetCurrentTransform(IDWriteBitmapRenderTarget
static HRESULT WINAPI rendertarget_GetSize(IDWriteBitmapRenderTarget *iface, SIZE *size)
{
struct rendertarget *This = impl_from_IDWriteBitmapRenderTarget(iface);
FIXME("(%p)->(%p): stub\n", This, size);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, size);
*size = This->size;
return S_OK;
}
static HRESULT WINAPI rendertarget_Resize(IDWriteBitmapRenderTarget *iface, UINT32 width, UINT32 height)
@ -175,6 +178,9 @@ static HRESULT create_rendertarget(HDC hdc, UINT32 width, UINT32 height, IDWrite
This->IDWriteBitmapRenderTarget_iface.lpVtbl = &rendertargetvtbl;
This->ref = 1;
This->size.cx = width;
This->size.cy = height;
This->hdc = CreateCompatibleDC(hdc);
memset(bmi, 0, sizeof(bmibuf));

View File

@ -158,6 +158,7 @@ static void test_CreateBitmapRenderTarget(void)
DIBSECTION ds;
HBITMAP hbm;
HRESULT hr;
SIZE size;
HDC hdc;
int ret;
@ -168,6 +169,15 @@ static void test_CreateBitmapRenderTarget(void)
hr = IDWriteGdiInterop_CreateBitmapRenderTarget(interop, NULL, 0, 0, &target);
EXPECT_HR(hr, S_OK);
if (0) /* crashes on native */
hr = IDWriteBitmapRenderTarget_GetSize(target, NULL);
size.cx = size.cy = -1;
hr = IDWriteBitmapRenderTarget_GetSize(target, &size);
EXPECT_HR(hr, S_OK);
ok(size.cx == 0, "got %d\n", size.cx);
ok(size.cy == 0, "got %d\n", size.cy);
target2 = NULL;
hr = IDWriteGdiInterop_CreateBitmapRenderTarget(interop, NULL, 0, 0, &target2);
EXPECT_HR(hr, S_OK);
@ -213,6 +223,12 @@ static void test_CreateBitmapRenderTarget(void)
ok(ds.dsBm.bmBitsPixel == 32, "got %d\n", ds.dsBm.bmBitsPixel);
ok(ds.dsBm.bmBits != NULL, "got %p\n", ds.dsBm.bmBits);
size.cx = size.cy = -1;
hr = IDWriteBitmapRenderTarget_GetSize(target, &size);
EXPECT_HR(hr, S_OK);
ok(size.cx == 10, "got %d\n", size.cx);
ok(size.cy == 5, "got %d\n", size.cy);
IDWriteBitmapRenderTarget_Release(target);
IDWriteGdiInterop_Release(interop);