dwrite: Implement SetCurrentTransform() for bitmap render target.

This commit is contained in:
Nikolay Sivov 2014-11-18 15:35:50 +03:00 committed by Alexandre Julliard
parent c457d0f107
commit 9db50228dd
2 changed files with 32 additions and 5 deletions

View File

@ -31,6 +31,13 @@
WINE_DEFAULT_DEBUG_CHANNEL(dwrite); WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
static const DWRITE_MATRIX identity =
{
1.0f, 0.0f,
0.0f, 1.0f,
0.0f, 0.0f
};
struct gdiinterop { struct gdiinterop {
IDWriteGdiInterop IDWriteGdiInterop_iface; IDWriteGdiInterop IDWriteGdiInterop_iface;
IDWriteFactory *factory; IDWriteFactory *factory;
@ -171,8 +178,11 @@ static HRESULT WINAPI rendertarget_GetCurrentTransform(IDWriteBitmapRenderTarget
static HRESULT WINAPI rendertarget_SetCurrentTransform(IDWriteBitmapRenderTarget *iface, DWRITE_MATRIX const *transform) static HRESULT WINAPI rendertarget_SetCurrentTransform(IDWriteBitmapRenderTarget *iface, DWRITE_MATRIX const *transform)
{ {
struct rendertarget *This = impl_from_IDWriteBitmapRenderTarget(iface); struct rendertarget *This = impl_from_IDWriteBitmapRenderTarget(iface);
FIXME("(%p)->(%p): stub\n", This, transform);
return E_NOTIMPL; TRACE("(%p)->(%p)\n", This, transform);
This->m = transform ? *transform : identity;
return S_OK;
} }
static HRESULT WINAPI rendertarget_GetSize(IDWriteBitmapRenderTarget *iface, SIZE *size) static HRESULT WINAPI rendertarget_GetSize(IDWriteBitmapRenderTarget *iface, SIZE *size)
@ -233,9 +243,7 @@ static HRESULT create_rendertarget(HDC hdc, UINT32 width, UINT32 height, IDWrite
return hr; return hr;
} }
target->m.m11 = target->m.m22 = 1.0; target->m = identity;
target->m.m12 = target->m.m21 = 0.0;
target->m.dx = target->m.dy = 0.0;
target->pixels_per_dip = 1.0; target->pixels_per_dip = 1.0;
*ret = &target->IDWriteBitmapRenderTarget_iface; *ret = &target->IDWriteBitmapRenderTarget_iface;

View File

@ -666,6 +666,25 @@ if (0) /* crashes on native */
ok(m.m11 == 1.0 && m.m22 == 1.0 && m.m12 == 0.0 && m.m21 == 0.0, "got %.1f,%.1f,%.1f,%.1f\n", m.m11, m.m22, m.m12, m.m21); ok(m.m11 == 1.0 && m.m22 == 1.0 && m.m12 == 0.0 && m.m21 == 0.0, "got %.1f,%.1f,%.1f,%.1f\n", m.m11, m.m22, m.m12, m.m21);
ok(m.dx == 0.0 && m.dy == 0.0, "got %.1f,%.1f\n", m.dx, m.dy); ok(m.dx == 0.0 && m.dy == 0.0, "got %.1f,%.1f\n", m.dx, m.dy);
memset(&m, 0, sizeof(m));
hr = IDWriteBitmapRenderTarget_SetCurrentTransform(target, &m);
ok(hr == S_OK, "got 0x%08x\n", hr);
memset(&m, 0xcc, sizeof(m));
hr = IDWriteBitmapRenderTarget_GetCurrentTransform(target, &m);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(m.m11 == 0.0 && m.m22 == 0.0 && m.m12 == 0.0 && m.m21 == 0.0, "got %.1f,%.1f,%.1f,%.1f\n", m.m11, m.m22, m.m12, m.m21);
ok(m.dx == 0.0 && m.dy == 0.0, "got %.1f,%.1f\n", m.dx, m.dy);
hr = IDWriteBitmapRenderTarget_SetCurrentTransform(target, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr);
memset(&m, 0xcc, sizeof(m));
hr = IDWriteBitmapRenderTarget_GetCurrentTransform(target, &m);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(m.m11 == 1.0 && m.m22 == 1.0 && m.m12 == 0.0 && m.m21 == 0.0, "got %.1f,%.1f,%.1f,%.1f\n", m.m11, m.m22, m.m12, m.m21);
ok(m.dx == 0.0 && m.dy == 0.0, "got %.1f,%.1f\n", m.dx, m.dy);
/* pixels per dip */ /* pixels per dip */
pdip = IDWriteBitmapRenderTarget_GetPixelsPerDip(target); pdip = IDWriteBitmapRenderTarget_GetPixelsPerDip(target);
ok(pdip == 1.0, "got %.2f\n", pdip); ok(pdip == 1.0, "got %.2f\n", pdip);