浏览代码

Win32: Handle content scale error on creation

Only apply the content scale to the initial size of the window if
content scale retrieval succeeded.

Related to #1615.

(cherry picked from commit 53d86c64d709ff52886580d338d9b3b2b1f27266)
Camilla Löwy 3 年之前
父节点
当前提交
a69648e192
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      src/win32_window.c

+ 6 - 2
src/win32_window.c

@@ -1297,8 +1297,12 @@ static int createNativeWindow(_GLFWwindow* window,
         {
             float xscale, yscale;
             _glfwPlatformGetWindowContentScale(window, &xscale, &yscale);
-            rect.right = (int) (rect.right * xscale);
-            rect.bottom = (int) (rect.bottom * yscale);
+
+            if (xscale > 0.f && yscale > 0.f)
+            {
+                rect.right = (int) (rect.right * xscale);
+                rect.bottom = (int) (rect.bottom * yscale);
+            }
         }
 
         ClientToScreen(window->win32.handle, (POINT*) &rect.left);