From 4b0f47cdbc7827b1a263156dba0cb88b57d84824 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 6 Feb 2015 09:56:59 +0100 Subject: [PATCH] d2d1: Implement d2d_bitmap_GetDpi(). --- dlls/d2d1/bitmap.c | 16 +++++++++++++--- dlls/d2d1/d2d1_private.h | 2 ++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/dlls/d2d1/bitmap.c b/dlls/d2d1/bitmap.c index b3ba570e47b..fd7a7a7db7a 100644 --- a/dlls/d2d1/bitmap.c +++ b/dlls/d2d1/bitmap.c @@ -107,10 +107,12 @@ static D2D1_PIXEL_FORMAT * STDMETHODCALLTYPE d2d_bitmap_GetPixelFormat(ID2D1Bitm static void STDMETHODCALLTYPE d2d_bitmap_GetDpi(ID2D1Bitmap *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_bitmap *bitmap = impl_from_ID2D1Bitmap(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 = bitmap->dpi_x; + *dpi_y = bitmap->dpi_y; } static HRESULT STDMETHODCALLTYPE d2d_bitmap_CopyFromBitmap(ID2D1Bitmap *iface, @@ -161,4 +163,12 @@ void d2d_bitmap_init(struct d2d_bitmap *bitmap, D2D1_SIZE_U size, const void *sr bitmap->refcount = 1; bitmap->pixel_size = size; + bitmap->dpi_x = desc->dpiX; + bitmap->dpi_y = desc->dpiY; + + if (bitmap->dpi_x == 0.0f && bitmap->dpi_y == 0.0f) + { + bitmap->dpi_x = 96.0f; + bitmap->dpi_y = 96.0f; + } } diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index 039612bd620..0402c8d0efe 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -154,6 +154,8 @@ struct d2d_bitmap LONG refcount; D2D1_SIZE_U pixel_size; + float dpi_x; + float dpi_y; }; void d2d_bitmap_init(struct d2d_bitmap *bitmap, D2D1_SIZE_U size, const void *src_data,