minor change in gltest

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1625 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2008-12-22 22:24:59 +00:00
parent ac825114c8
commit af3341e3d6
2 changed files with 26 additions and 8 deletions

View File

@ -16,10 +16,15 @@ bool SDLWindow::PeekMessages() {
void SDLWindow::Update() { void SDLWindow::Update() {
SDL_Surface *surface = SDL_GetVideoSurface(); 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 FactorW = 640.0f / (float)GetWidth();
float FactorH = 480.0f / (float)surface->h; float FactorH = 480.0f / (float)GetHeight();
float Max = (FactorW < FactorH) ? FactorH : FactorW; float Max = (FactorW < FactorH) ? FactorH : FactorW;
// AR = (float)surface->w / (float)surface->h;; // AR = (float)surface->w / (float)surface->h;;
@ -28,11 +33,10 @@ void SDLWindow::Update() {
SetOffset(0,0); SetOffset(0,0);
} else { } else {
SetMax(1.0f / Max, 1.0f / Max); SetMax(1.0f / Max, 1.0f / Max);
SetOffset((int)((surface->w - (640 * GetXmax())) / 2), SetOffset((int)((GetWidth() - (640 * GetXmax())) / 2),
(int)((surface->h - (480 * GetYmax())) / 2)); (int)((GetHeight() - (480 * GetYmax())) / 2));
} }
SetSize(surface->w, surface->h);
} }
bool SDLWindow::MakeCurrent() { bool SDLWindow::MakeCurrent() {

View File

@ -265,7 +265,21 @@ void X11Window::Update() {
break; 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() { bool X11Window::MakeCurrent() {