diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-05-20 15:20:41 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-05-21 15:43:56 +0000 |
commit | 56d2cab4704f079ca173d65619432665bc1a1c92 (patch) | |
tree | 18fc983d726c2ad5e77bceb78df4dc7abae54c8a /vcl/opengl/win | |
parent | 29428a5979ecf37eca7eb690a6acbc2897122753 (diff) |
split GLWindow into platform dependent parts and move to respective backends
Change-Id: I636d9bdac907000e4089aebdc5548ea89ec58083
Reviewed-on: https://gerrit.libreoffice.org/25252
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/opengl/win')
-rw-r--r-- | vcl/opengl/win/gdiimpl.cxx | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx index 50fb3928600e..1f6b044d9a64 100644 --- a/vcl/opengl/win/gdiimpl.cxx +++ b/vcl/opengl/win/gdiimpl.cxx @@ -13,15 +13,35 @@ #include <win/saldata.hxx> #include <win/salframe.h> #include <win/salinst.h> +#include <GL/wglew.h> static std::vector<HGLRC> g_vShareList; +class GLWinWindow : public GLWindow +{ +public: + HWND hWnd; + HDC hDC; + HGLRC hRC; + GLWinWindow(); +}; + +GLWinWindow::GLWinWindow() + : hWnd(NULL) + , hDC(NULL) + , hRC(NULL) +{ +} + class WinOpenGLContext : public OpenGLContext { public: bool init( HDC hDC, HWND hWnd ); virtual bool initWindow() override; private: + GLWinWindow m_aGLWin; + virtual const GLWindow& getOpenGLWindow() const { return m_aGLWin; } + virtual GLWindow& getModifiableOpenGLWindow() { return m_aGLWin; } virtual bool ImplInit() override; virtual void makeCurrent() override; virtual void destroyCurrentContext() override; @@ -150,7 +170,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM l } } -int InitTempWindow(HWND *hwnd, int width, int height, const PIXELFORMATDESCRIPTOR& inPfd, GLWindow& glWin) +int InitTempWindow(HWND *hwnd, int width, int height, const PIXELFORMATDESCRIPTOR& inPfd, GLWinWindow& glWin) { OpenGLZone aZone; @@ -239,7 +259,7 @@ bool InitMultisample(const PIXELFORMATDESCRIPTOR& pfd, int& rPixelFormat, OpenGLZone aZone; HWND hWnd = NULL; - GLWindow glWin; + GLWinWindow glWin; // Create a temp window to check whether support multi-sample, if support, get the format if (InitTempWindow(&hWnd, 1, 1, pfd, glWin) < 0) { @@ -507,15 +527,17 @@ rtl::Reference<OpenGLContext> WinOpenGLSalGraphicsImpl::CreateWinContext() void WinOpenGLSalGraphicsImpl::Init() { - if ( !IsOffscreen() && mpContext.is() && mpContext->isInitialized() && - ( mpContext->getOpenGLWindow().hWnd != mrParent.mhWnd || - mpContext->getOpenGLWindow().hDC == mrParent.mhLocalDC ) ) + if (!IsOffscreen() && mpContext.is() && mpContext->isInitialized()) { - // This can legitimately happen, SalFrame keeps 2x - // SalGraphics which share the same hWnd and hDC. - // The shape 'Area' dialog does reparenting to trigger this. - SAL_WARN("vcl.opengl", "Unusual: Windows handle / DC changed without DeInit"); - DeInit(); + const GLWinWindow& rGLWindow = static_cast<const GLWinWindow&>(mpContext->getOpenGLWindow()); + if (rGLWindow.hWnd != mrParent.mhWnd || rGLWindow.hDC == mrParent.mhLocalDC) + { + // This can legitimately happen, SalFrame keeps 2x + // SalGraphics which share the same hWnd and hDC. + // The shape 'Area' dialog does reparenting to trigger this. + SAL_WARN("vcl.opengl", "Unusual: Windows handle / DC changed without DeInit"); + DeInit(); + } } OpenGLSalGraphicsImpl::Init(); |