Bladeren bron

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 jaren geleden
bovenliggende
commit
a69648e192
1 gewijzigde bestanden met toevoegingen van 6 en 2 verwijderingen
  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);