summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-06-07 16:11:02 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-06-07 16:11:20 +0000
commit78b100ec9cb0db2f7b33ece5ad3287a67a37246f (patch)
tree09915b94cacc0f590850b2dc5772cff617b46e4b /vcl
parent665844d8dd0cf4b3fc6cdb56f3e155704ba76b00 (diff)
only init the OpenGL context if we need it
Change-Id: Ia88a1720d204b9933f1476bd703b99180e45abde Reviewed-on: https://gerrit.libreoffice.org/26023 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/openglwin.cxx45
1 files changed, 39 insertions, 6 deletions
diff --git a/vcl/source/window/openglwin.cxx b/vcl/source/window/openglwin.cxx
index 442d1daa6483..bef5a8035a60 100644
--- a/vcl/source/window/openglwin.cxx
+++ b/vcl/source/window/openglwin.cxx
@@ -15,21 +15,33 @@
class OpenGLWindowImpl
{
public:
- explicit OpenGLWindowImpl(vcl::Window* pWindow);
+ explicit OpenGLWindowImpl(vcl::Window* pWindow, bool bInit);
~OpenGLWindowImpl();
OpenGLContext& getContext() { return *mxContext.get(); }
+
+ bool IsInitialized() const;
+
+ void Initialize();
+
private:
+
rtl::Reference<OpenGLContext> mxContext;
VclPtr<SystemChildWindow> mxChildWindow;
+
+ bool mbInitialized;
};
-OpenGLWindowImpl::OpenGLWindowImpl(vcl::Window* pWindow)
- : mxContext(OpenGLContext::Create())
+OpenGLWindowImpl::OpenGLWindowImpl(vcl::Window* pWindow, bool bInit)
+ : mxContext(OpenGLContext::Create()),
+ mbInitialized(bInit)
{
SystemWindowData aData = mxContext->generateWinData(pWindow, false);
mxChildWindow.reset(VclPtr<SystemChildWindow>::Create(pWindow, 0, &aData));
mxChildWindow->Show();
- mxContext->init(mxChildWindow.get());
+
+ if (bInit)
+ mxContext->init(mxChildWindow.get());
+
pWindow->SetMouseTransparent(false);
}
@@ -39,9 +51,19 @@ OpenGLWindowImpl::~OpenGLWindowImpl()
mxChildWindow.disposeAndClear();
}
-OpenGLWindow::OpenGLWindow(vcl::Window* pParent):
+bool OpenGLWindowImpl::IsInitialized() const
+{
+ return mbInitialized;
+}
+
+void OpenGLWindowImpl::Initialize()
+{
+ mxContext->init(mxChildWindow.get());
+}
+
+OpenGLWindow::OpenGLWindow(vcl::Window* pParent, bool bInit):
Window(pParent, 0),
- mxImpl(new OpenGLWindowImpl(this)),
+ mxImpl(new OpenGLWindowImpl(this, bInit)),
mpRenderer(nullptr)
{
}
@@ -118,4 +140,15 @@ void OpenGLWindow::setRenderer(IRenderer* pRenderer)
mpRenderer = pRenderer;
}
+bool OpenGLWindow::IsInitialized() const
+{
+ return mxImpl->IsInitialized();
+}
+
+void OpenGLWindow::Initialize()
+{
+ if (!IsInitialized())
+ mxImpl->Initialize();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */