[Gdiplus 1/6] Improve accuracy in calculating point sizes (try 2)

Adam Petaccia adam at tpetaccia.com
Fri Jun 27 19:06:24 CDT 2008


Changelog: rename some constants to not tell lies

Subject: [Gdiplus 1/6] Improve accuracy in calculating point sizes
 The previous version was wrong. Also rename a misnamed constant.

---
 dlls/gdiplus/font.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c
index 86a3223..4ebc6ac 100644
--- a/dlls/gdiplus/font.c
+++ b/dlls/gdiplus/font.c
@@ -33,7 +33,8 @@ WINE_DEFAULT_DEBUG_CHANNEL (gdiplus);
 #include "gdiplus.h"
 #include "gdiplus_private.h"
 
-static const REAL mm_per_pixel = 25.4;
+static const REAL mm_per_inch = 25.4;
+static const REAL inch_per_point = 1.0/72.0;
 
 static inline REAL get_dpi (void)
 {
@@ -50,7 +51,7 @@ static inline REAL get_dpi (void)
 
 static inline REAL point_to_pixel (REAL point)
 {
-    return point * 1.5;
+    return point * get_dpi() * inch_per_point;
 }
 
 static inline REAL inch_to_pixel (REAL inch)
@@ -65,7 +66,7 @@ static inline REAL document_to_pixel (REAL doc)
 
 static inline REAL mm_to_pixel (REAL mm)
 {
-    return mm * (get_dpi() / mm_per_pixel);
+    return mm * (get_dpi() / mm_per_inch);
 }
 
 /*******************************************************************************
-- 
1.5.4.3





More information about the wine-patches mailing list