Author: tkreuzer
Date: Thu Dec 23 12:11:19 2010
New Revision: 50112
URL:
http://svn.reactos.org/svn/reactos?rev=50112&view=rev
Log:
[VBEMP]
Fix rounding error when calculating display size
Loosely based on patch by neoman.
Fixes gdi32_winetest:mapping
See issue #5790 for more details.
Modified:
trunk/reactos/drivers/video/miniport/vbe/vbemp.c
Modified: trunk/reactos/drivers/video/miniport/vbe/vbemp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/video/miniport/vbe…
==============================================================================
--- trunk/reactos/drivers/video/miniport/vbe/vbemp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/video/miniport/vbe/vbemp.c [iso-8859-1] Thu Dec 23 12:11:19
2010
@@ -847,6 +847,7 @@
ULONG VideoModeId)
{
PVBE_MODEINFO VBEMode = &DeviceExtension->ModeInfo[VideoModeId];
+ ULONG dpi;
VideoMode->Length = sizeof(VIDEO_MODE_INFORMATION);
VideoMode->ModeIndex = VideoModeId;
@@ -860,9 +861,10 @@
VideoMode->BitsPerPlane = VBEMode->BitsPerPixel / VBEMode->NumberOfPlanes;
VideoMode->Frequency = 1;
- /* Assume 96DPI and 25.4 millimeters per inch */
- VideoMode->XMillimeter = VBEMode->XResolution * 254 / 960;
- VideoMode->YMillimeter = VBEMode->YResolution * 254 / 960;
+ /* Assume 96DPI and 25.4 millimeters per inch, round to nearest */
+ dpi = 96;
+ VideoMode->XMillimeter = ((ULONGLONG)VBEMode->XResolution * 254 + (dpi * 5)) /
(dpi * 10);
+ VideoMode->YMillimeter = ((ULONGLONG)VBEMode->YResolution * 254 + (dpi * 5)) /
(dpi * 10);
if (VBEMode->BitsPerPixel > 8)
{