summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/opengl/OpenGLContext.hxx2
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx12
-rw-r--r--vcl/win/source/gdi/salgdi.cxx6
3 files changed, 19 insertions, 1 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 1692ba0f5da2..3a8ec9ad8484 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -164,6 +164,8 @@ public:
// only in vcl's platform code
#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
bool init(Display* dpy, Window win, int screen);
+#elif defined( _WIN32 )
+ bool init( HDC hDC, HWND hWnd );
#endif
void makeCurrent();
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index b4c2cee2a2cc..fe97372ec5b6 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -513,6 +513,16 @@ bool OpenGLContext::init(Display* dpy, Window win, int screen)
return ImplInit();
}
+#elif defined( _WIN32 )
+bool OpenGLContext::init(HDC hDC, HWND hWnd)
+{
+ if (mbInitialized)
+ return false;
+
+ m_aGLWin.hDC = hDC;
+ m_aGLWin.hWnd = hWnd;
+ return ImplInit();
+}
#endif
bool OpenGLContext::ImplInit()
@@ -524,7 +534,6 @@ bool OpenGLContext::ImplInit()
m_aGLWin.Height = 0;
#if defined( WNT )
- m_aGLWin.hDC = GetDC(m_aGLWin.hWnd);
#elif defined( MACOSX )
#elif defined( IOS )
@@ -778,6 +787,7 @@ bool OpenGLContext::initWindow()
m_aGLWin.hWnd = sysData->hWnd;
}
+ m_aGLWin.hDC = GetDC(m_aGLWin.hWnd);
return true;
}
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index e3a6fadfa2bf..97f102e4d2ea 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -483,6 +483,12 @@ void WinSalGraphics::InitGraphics()
::SetTextAlign( getHDC(), TA_BASELINE | TA_LEFT | TA_NOUPDATECP );
::SetBkMode( getHDC(), WIN32_TRANSPARENT );
::SetROP2( getHDC(), R2_COPYPEN );
+
+ OpenGLSalGraphicsImpl* pImpl = dynamic_cast<OpenGLSalGraphicsImpl*>(mpImpl.get());
+ if (pImpl)
+ {
+ pImpl->GetOpenGLContext().init(mhLocalDC, mhWnd);
+ }
}
void WinSalGraphics::DeInitGraphics()