gdiplus: Improve precision of calculated pixel to units transformation.

This commit is contained in:
Dmitry Timoshkov 2012-07-31 18:48:46 +09:00 committed by Alexandre Julliard
parent 747d1631d5
commit 3298a30211
1 changed files with 3 additions and 3 deletions

View File

@ -36,7 +36,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
static const REAL mm_per_inch = 25.4; static const REAL mm_per_inch = 25.4;
static const REAL inch_per_point = 1.0/72.0; static const REAL point_per_inch = 72.0;
static Status WINAPI NotificationHook(ULONG_PTR *token) static Status WINAPI NotificationHook(ULONG_PTR *token)
{ {
@ -353,7 +353,7 @@ REAL units_to_pixels(REAL units, GpUnit unit, REAL dpi)
case UnitDisplay: case UnitDisplay:
return units; return units;
case UnitPoint: case UnitPoint:
return units * dpi * inch_per_point; return units * dpi / point_per_inch;
case UnitInch: case UnitInch:
return units * dpi; return units * dpi;
case UnitDocument: case UnitDocument:
@ -376,7 +376,7 @@ REAL pixels_to_units(REAL pixels, GpUnit unit, REAL dpi)
case UnitDisplay: case UnitDisplay:
return pixels; return pixels;
case UnitPoint: case UnitPoint:
return pixels / dpi / inch_per_point; return pixels * point_per_inch / dpi;
case UnitInch: case UnitInch:
return pixels / dpi; return pixels / dpi;
break; break;