mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 23:29:44 -06:00
Restructured OpenGL_Update() to reduce duplicated code.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@318 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -487,37 +487,16 @@ void OpenGL_Update()
|
|||||||
//TODO
|
//TODO
|
||||||
|
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
if (EmuWindow::GetParentWnd())
|
if (!EmuWindow::GetParentWnd()) return;
|
||||||
{
|
RECT rcWindow;
|
||||||
RECT rcWindow;
|
GetWindowRect(EmuWindow::GetParentWnd(), &rcWindow);
|
||||||
GetWindowRect(EmuWindow::GetParentWnd(), &rcWindow);
|
|
||||||
|
|
||||||
int width = rcWindow.right - rcWindow.left;
|
int width = rcWindow.right - rcWindow.left;
|
||||||
int height = rcWindow.bottom - rcWindow.top;
|
int height = rcWindow.bottom - rcWindow.top;
|
||||||
|
|
||||||
::MoveWindow(EmuWindow::GetWnd(), 0,0,width,height, FALSE);
|
::MoveWindow(EmuWindow::GetWnd(), 0,0,width,height, FALSE);
|
||||||
nBackbufferWidth = width;
|
nBackbufferWidth = width;
|
||||||
nBackbufferHeight = height;
|
nBackbufferHeight = height;
|
||||||
float FactorW = 640.0f / (float)nBackbufferWidth;
|
|
||||||
float FactorH = 480.0f / (float)nBackbufferHeight;
|
|
||||||
|
|
||||||
float Max = (FactorW < FactorH) ? FactorH : FactorW;
|
|
||||||
|
|
||||||
if(g_Config.bStretchToFit)
|
|
||||||
{
|
|
||||||
MValueX = 1.0f / FactorW;
|
|
||||||
MValueY = 1.0f / FactorH;
|
|
||||||
nXoff = 0;
|
|
||||||
nYoff = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MValueX = 1.0f / Max;
|
|
||||||
MValueY = 1.0f / Max;
|
|
||||||
nXoff = (nBackbufferWidth - (640 * MValueX)) / 2;
|
|
||||||
nYoff = (nBackbufferHeight - (480 * MValueY)) / 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#else // GLX
|
#else // GLX
|
||||||
Window winDummy;
|
Window winDummy;
|
||||||
@ -526,6 +505,9 @@ void OpenGL_Update()
|
|||||||
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
|
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
|
||||||
nBackbufferWidth = GLWin.width;
|
nBackbufferWidth = GLWin.width;
|
||||||
nBackbufferHeight = GLWin.height;
|
nBackbufferHeight = GLWin.height;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
float FactorW = 640.0f / (float)nBackbufferWidth;
|
float FactorW = 640.0f / (float)nBackbufferWidth;
|
||||||
float FactorH = 480.0f / (float)nBackbufferHeight;
|
float FactorH = 480.0f / (float)nBackbufferHeight;
|
||||||
|
|
||||||
@ -545,7 +527,6 @@ void OpenGL_Update()
|
|||||||
nXoff = (nBackbufferWidth - (640 * MValueX)) / 2;
|
nXoff = (nBackbufferWidth - (640 * MValueX)) / 2;
|
||||||
nYoff = (nBackbufferHeight - (480 * MValueY)) / 2;
|
nYoff = (nBackbufferHeight - (480 * MValueY)) / 2;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user