Do not scale in normal-dpi modes

This commit is contained in:
Stefanos A. 2013-11-14 09:25:53 +01:00
parent 7c8cc5f746
commit 21069ee34c

View file

@ -123,12 +123,26 @@ namespace OpenTK.Platform.Windows
// Move(this, EventArgs.Empty);
//};
// To avoid issues with Ati drivers on Windows 6+ with compositing enabled, the context will not be
// bound to the top-level window, but rather to a child window docked in the parent.
// CreateWindow takes values in pixels.
// According to the high-dpi guidelines,
// we need to scale these values by the
// current DPI.
// Search MSDN for "How to Ensure That
// Your Application Displays Properly on
// High-DPI Displays"
int scale_width = ScaleX(width);
int scale_height = ScaleY(height);
int scale_x = x - UnscaleX(scale_width - width);
int scale_y = y - UnscaleY(scale_height - height);
int scale_x = x;
int scale_y = y;
// If width or height were scaled, re-calculate
// the x and y coordinates to compensate
if (width != scale_width)
scale_x = x - UnscaleX(scale_width - width);
if (height != scale_height)
scale_y = y - UnscaleY(scale_height - height);
// To avoid issues with Ati drivers on Windows 6+ with compositing enabled, the context will not be
// bound to the top-level window, but rather to a child window docked in the parent.
window = new WinWindowInfo(
CreateWindow(
scale_x, scale_y, scale_width, scale_height,