Commit c843e71b authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Implement IDWriteBitmapRenderTarget_GetSize.

parent 292fd912
......@@ -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));
......
......@@ -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);
......
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