diff --git a/dlls/dwrite/gdiinterop.c b/dlls/dwrite/gdiinterop.c index c3bcc889965..bac6e40e0fb 100644 --- a/dlls/dwrite/gdiinterop.c +++ b/dlls/dwrite/gdiinterop.c @@ -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)); diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index 97cd4775cc2..ccaba88026a 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -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);