summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/GLInterface/WGL.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/DolphinWX/GLInterface/WGL.cpp')
-rw-r--r--Source/Core/DolphinWX/GLInterface/WGL.cpp27
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;