[PATCH 2/5] d2d1: Implement d2d_bitmap_GetDpi().

Henri Verbeet hverbeet at codeweavers.com
Fri Feb 6 02:56:59 CST 2015


---
 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 b3ba570..fd7a7a7 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);
+
+    TRACE("iface %p, dpi_x %p, dpi_y %p.\n", iface, dpi_x, dpi_y);
 
-    *dpi_x = 96.0f;
-    *dpi_y = 96.0f;
+    *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 039612b..0402c8d 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,
-- 
1.7.10.4




More information about the wine-patches mailing list