From 3e2a7493e0cb13a59ec7ebaccacaa6cda062ba3a Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 4 Sep 2014 08:14:29 +0200 Subject: [PATCH] d2d1: Implement d2d_d3d_render_target_GetDpi(). --- dlls/d2d1/d2d1_private.h | 2 ++ dlls/d2d1/render_target.c | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index 925fafb126f..5bbac5cd697 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -31,6 +31,8 @@ struct d2d_d3d_render_target D2D1_SIZE_U pixel_size; D2D1_MATRIX_3X2_F transform; + float dpi_x; + float dpi_y; }; HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target, ID2D1Factory *factory, diff --git a/dlls/d2d1/render_target.c b/dlls/d2d1/render_target.c index 2c079a35c0d..39b0dadea10 100644 --- a/dlls/d2d1/render_target.c +++ b/dlls/d2d1/render_target.c @@ -466,10 +466,12 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_SetDpi(ID2D1RenderTarget *if static void STDMETHODCALLTYPE d2d_d3d_render_target_GetDpi(ID2D1RenderTarget *iface, float *dpi_x, float *dpi_y) { - FIXME("iface %p, dpi_x %p, dpi_y %p stub!\n", iface, dpi_x, dpi_y); + struct d2d_d3d_render_target *render_target = impl_from_ID2D1RenderTarget(iface); - *dpi_x = 96.0f; - *dpi_y = 96.0f; + TRACE("iface %p, dpi_x %p, dpi_y %p.\n", iface, dpi_x, dpi_y); + + *dpi_x = render_target->dpi_x; + *dpi_y = render_target->dpi_y; } static D2D1_SIZE_F STDMETHODCALLTYPE d2d_d3d_render_target_GetSize(ID2D1RenderTarget *iface) @@ -593,6 +595,14 @@ HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target, render_target->pixel_size.width = surface_desc.Width; render_target->pixel_size.height = surface_desc.Height; render_target->transform = identity; + render_target->dpi_x = desc->dpiX; + render_target->dpi_y = desc->dpiY; + + if (render_target->dpi_x == 0.0f && render_target->dpi_y == 0.0f) + { + render_target->dpi_x = 96.0f; + render_target->dpi_y = 96.0f; + } return S_OK; }