diff options
| author | Lioncash <mathew1800@gmail.com> | 2014-08-05 02:51:32 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2014-08-08 19:21:42 -0400 |
| commit | df67a18c42d543657c876954a1b5bac166b9de51 (patch) | |
| tree | f4f6a26f7bd8a2bede1ff984ec3d7d9515c48e04 /Source/Core/DolphinWX/GLInterface/WGL.cpp | |
| parent | 2b341bb267bd31b048a0031f651a598cc6506730 (diff) | |
WGL: Get rid of the use of the Host_GetRenderWindowSize() call.
Just use the Windows API to accomplish the same thing (this is what is done in Update()).
This makes the backing window handle the correct data-type for Windows for easier use in function calls.
Diffstat (limited to 'Source/Core/DolphinWX/GLInterface/WGL.cpp')
| -rw-r--r-- | Source/Core/DolphinWX/GLInterface/WGL.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/Source/Core/DolphinWX/GLInterface/WGL.cpp b/Source/Core/DolphinWX/GLInterface/WGL.cpp index 94bc0e3c36..39e18f9105 100644 --- a/Source/Core/DolphinWX/GLInterface/WGL.cpp +++ b/Source/Core/DolphinWX/GLInterface/WGL.cpp @@ -58,7 +58,7 @@ bool cInterfaceWGL::PeekMessages() // Show the current FPS void cInterfaceWGL::UpdateFPSDisplay(const std::string& text) { - SetWindowTextA((HWND)m_window_handle, text.c_str()); + SetWindowTextA(m_window_handle, text.c_str()); } // Create rendering window. @@ -68,14 +68,19 @@ bool cInterfaceWGL::Create(void *&window_handle) if (window_handle == nullptr) return false; - int _tx, _ty, _twidth, _theight; - Host_GetRenderWindowSize(_tx, _ty, _twidth, _theight); + HWND window_handle_reified = reinterpret_cast<HWND>(window_handle); + RECT window_rect = {0}; + + if (!GetClientRect(window_handle_reified, &window_rect)) + return false; // Control window size and picture scaling - s_backbuffer_width = _twidth; - s_backbuffer_height = _theight; + int twidth = (window_rect.right - window_rect.left); + int theight = (window_rect.bottom - window_rect.top); + s_backbuffer_width = twidth; + s_backbuffer_height = theight; - m_window_handle = window_handle; + m_window_handle = window_handle_reified; #ifdef _WIN32 dllHandle = LoadLibrary(TEXT("OpenGL32.dll")); @@ -105,7 +110,7 @@ bool cInterfaceWGL::Create(void *&window_handle) int PixelFormat; // Holds The Results After Searching For A Match - if (!(hDC = GetDC((HWND)window_handle))) { + if (!(hDC = GetDC(window_handle_reified))) { PanicAlert("(1) Can't create an OpenGL Device context. Fail."); return false; } @@ -145,11 +150,11 @@ bool cInterfaceWGL::ClearCurrent() void cInterfaceWGL::Update() { RECT rcWindow; - GetClientRect((HWND)m_window_handle, &rcWindow); + GetClientRect(m_window_handle, &rcWindow); // Get the new window width and height - s_backbuffer_width = rcWindow.right - rcWindow.left; - s_backbuffer_height = rcWindow.bottom - rcWindow.top; + s_backbuffer_width = (rcWindow.right - rcWindow.left); + s_backbuffer_height = (rcWindow.bottom - rcWindow.top); } // Close backend @@ -166,7 +171,7 @@ void cInterfaceWGL::Shutdown() hRC = nullptr; } - if (hDC && !ReleaseDC((HWND)m_window_handle, hDC)) + if (hDC && !ReleaseDC(m_window_handle, hDC)) { ERROR_LOG(VIDEO, "Attempt to release device context failed."); hDC = nullptr; |
