more code cleanup

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1622 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee
2008-12-21 21:02:43 +00:00
parent 1b0cb56d2b
commit a7c4697d22
16 changed files with 73 additions and 55 deletions

View File

@ -24,14 +24,12 @@ void SDLWindow::Update() {
// AR = (float)surface->w / (float)surface->h;;
if (g_Config.bStretchToFit) {
MValueX = 1;
MValueY = 1;
SetMax(1,1);
SetOffset(0,0);
} else {
MValueX = 1.0f / Max;
MValueY = 1.0f / Max;
SetOffset((int)((surface->w - (640 * MValueX)) / 2),
(int)((surface->h - (480 * MValueY)) / 2));
SetMax(1.0f / Max, 1.0f / Max);
SetOffset((int)((surface->w - (640 * GetXmax())) / 2),
(int)((surface->h - (480 * GetYmax())) / 2));
}
SetSize(surface->w, surface->h);
@ -49,7 +47,7 @@ bool SDLWindow::MakeCurrent() {
// Fetch video info.
const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo();
if (!videoInfo) {
// TODO: Display an error message.
PanicAlert("Couldn't get video info");
SDL_Quit();
return false;
}
@ -62,7 +60,7 @@ bool SDLWindow::MakeCurrent() {
SDL_Surface *screen = SDL_SetVideoMode(GetWidth(), GetHeight(),
0, videoFlags);
if (!screen) {
//TODO : Display an error message
PanicAlert("Couldn't set video mode");
SDL_Quit();
return false;
}
@ -99,18 +97,17 @@ SDLWindow::SDLWindow(int _iwidth, int _iheight) {
float Max = (FactorW < FactorH) ? FactorH : FactorW;
if(g_Config.bStretchToFit) {
MValueX = 1.0f / FactorW;
MValueY = 1.0f / FactorH;
SetMax(1.0f / FactorW, 1.0f / FactorH);
SetOffset(0,0);
} else {
MValueX = 1.0f / Max;
MValueY = 1.0f / Max;
SetOffset((int)((_twidth - (640 * MValueX)) / 2),
(int)((_theight - (480 * MValueY)) / 2));
SetMax(1.0f / Max, 1.0f / Max);
SetOffset((int)((_twidth - (640 * GetXmax())) / 2),
(int)((_theight - (480 * GetYmax())) / 2));
}
//init sdl video
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
PanicAlert("Failed to init SDL");
//TODO : Display an error message
SDL_Quit();
// return NULL;