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() {
SDL_Surface *surface = SDL_GetVideoSurface();
if (!surface) return;
if (!surface) {
PanicAlert("Can't ge t surface to update");
return;
}
float FactorW = 640.0f / (float)surface->w;
float FactorH = 480.0f / (float)surface->h;
SetSize(surface->w, 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,10 +33,9 @@ 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);
}

View file

@ -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() {