diff --git a/Source/Plugins/Plugin_VideoOGL/Src/SDLWindow.cpp b/Source/Plugins/Plugin_VideoOGL/Src/SDLWindow.cpp index d289165117..a90bfe9c41 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/SDLWindow.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/SDLWindow.cpp @@ -16,10 +16,15 @@ bool SDLWindow::PeekMessages() { void SDLWindow::Update() { SDL_Surface *surface = SDL_GetVideoSurface(); - if (!surface) return; + if (!surface) { + PanicAlert("Can't ge t surface to update"); + return; + } + + SetSize(surface->w, surface->h); - float FactorW = 640.0f / (float)surface->w; - float FactorH = 480.0f / (float)surface->h; + float FactorW = 640.0f / (float)GetWidth(); + float FactorH = 480.0f / (float)GetHeight(); float Max = (FactorW < FactorH) ? FactorH : FactorW; // AR = (float)surface->w / (float)surface->h;; @@ -28,11 +33,10 @@ void SDLWindow::Update() { SetOffset(0,0); } else { SetMax(1.0f / Max, 1.0f / Max); - SetOffset((int)((surface->w - (640 * GetXmax())) / 2), - (int)((surface->h - (480 * GetYmax())) / 2)); + SetOffset((int)((GetWidth() - (640 * GetXmax())) / 2), + (int)((GetHeight() - (480 * GetYmax())) / 2)); } - SetSize(surface->w, surface->h); - + } bool SDLWindow::MakeCurrent() { diff --git a/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp b/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp index 3125711f80..389c3a7fc3 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp @@ -265,7 +265,21 @@ void X11Window::Update() { break; } } - return; + + float FactorW = 640.0f / (float)GetWidth(); + float FactorH = 480.0f / (float)GetHeight(); + float Max = (FactorW < FactorH) ? FactorH : FactorW; + // AR = (float)surface->w / (float)surface->h;; + + if (g_Config.bStretchToFit) { + SetMax(1,1); + SetOffset(0,0); + } else { + SetMax(1.0f / Max, 1.0f / Max); + SetOffset((int)((GetWidth() - (640 * GetXmax())) / 2), + (int)((GetHeight() - (480 * GetYmax())) / 2)); + } + } bool X11Window::MakeCurrent() {