Browse Source

Fix calculating fullscreen resolution error metric. Closes #399.

Lasse Öörni 11 years ago
parent
commit
3d649a9f19

+ 1 - 1
Source/Engine/Graphics/Direct3D9/D3D9Graphics.cpp

@@ -405,7 +405,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
 
             for (unsigned i = 0; i < resolutions.Size(); ++i)
             {
-                unsigned error = Abs(resolutions[i].x_ - width) * Abs(resolutions[i].y_ - height);
+                unsigned error = Abs(resolutions[i].x_ - width) + Abs(resolutions[i].y_ - height);
                 if (error < bestError)
                 {
                     best = i;

+ 1 - 1
Source/Engine/Graphics/OpenGL/OGLGraphics.cpp

@@ -330,7 +330,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool borderless,
 
             for (unsigned i = 0; i < resolutions.Size(); ++i)
             {
-                unsigned error = Abs(resolutions[i].x_ - width) * Abs(resolutions[i].y_ - height);
+                unsigned error = Abs(resolutions[i].x_ - width) + Abs(resolutions[i].y_ - height);
                 if (error < bestError)
                 {
                     best = i;