diff options
| author | nakeee <nakeee@gmail.com> | 2008-12-22 22:24:59 +0000 |
|---|---|---|
| committer | nakeee <nakeee@gmail.com> | 2008-12-22 22:24:59 +0000 |
| commit | af3341e3d69cd7813430d36cd77b06d85d222fbf (patch) | |
| tree | d573c3404d0ad6bfee3c00c3556585c75a047273 /Source | |
| parent | ac825114c86dff8444b524c6017a9ea1f0add3b9 (diff) | |
minor change in gltest
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1625 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Plugins/Plugin_VideoOGL/Src/SDLWindow.cpp | 18 | ||||
| -rw-r--r-- | Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp | 16 |
2 files changed, 26 insertions, 8 deletions
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() { |
