Ver código fonte

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.
Camilla Löwy 3 anos atrás
pai
commit
53d86c64d7
1 arquivos alterados com 6 adições e 2 exclusões
  1. 6 2
      src/win32_window.c

+ 6 - 2
src/win32_window.c

@@ -1304,8 +1304,12 @@ static int createNativeWindow(_GLFWwindow* window,
         {
         {
             float xscale, yscale;
             float xscale, yscale;
             _glfwGetWindowContentScaleWin32(window, &xscale, &yscale);
             _glfwGetWindowContentScaleWin32(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);
         ClientToScreen(window->win32.handle, (POINT*) &rect.left);