Henri Verbeet : d2d1: Implement d2d_bitmap_GetDpi().

Alexandre Julliard julliard at wine.codeweavers.com
Fri Feb 6 10:41:38 CST 2015


Module: wine
Branch: master
Commit: 4b0f47cdbc7827b1a263156dba0cb88b57d84824
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4b0f47cdbc7827b1a263156dba0cb88b57d84824

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Fri Feb  6 09:56:59 2015 +0100

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 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,




More information about the wine-cvs mailing list