瀏覽代碼

Round the window size values when using fixed aspect ratio

This won't get you pixel perfect values, since the exact ratio won't necessarily be whole pixel values, but it will be closer, and matches the logic in the other branch.
Sam Lantinga 1 年之前
父節點
當前提交
4add7e2005
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/video/windows/SDL_windowsevents.c

+ 2 - 2
src/video/windows/SDL_windowsevents.c

@@ -1592,11 +1592,11 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
                 switch (edge) {
                 switch (edge) {
                 case WMSZ_LEFT:
                 case WMSZ_LEFT:
                 case WMSZ_RIGHT:
                 case WMSZ_RIGHT:
-                    h = (int)(w / data->window->max_aspect);
+                    h = (int)SDL_roundf(w / data->window->max_aspect);
                     break;
                     break;
                 default:
                 default:
                     // resizing via corners or top or bottom
                     // resizing via corners or top or bottom
-                    w = (int)(h*data->window->max_aspect);
+                    w = (int)SDL_roundf(h * data->window->max_aspect);
                     break;
                     break;
                 }
                 }
             } else {
             } else {