summaryrefslogtreecommitdiff
path: root/include/vcl/opengl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-09-07 22:21:15 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-09-08 13:04:02 +0100
commit2456cf8306be22e32130e789ab939c059e5e79e5 (patch)
treed188be461e188023fd4da0690e6278e76e596c2d /include/vcl/opengl
parent64c6b0ed6c67d169021732d276ec02706e139261 (diff)
tdf#94006 - re-factor to use rtl::Reference for OpenGLContexts.
Don't use rtl::Reference for the global / list state, so the ref-count reflects the number of real users. Hold a reference during ~OpenGLContext. Change-Id: I4e57a7246159acd58ae7d5a0dfc8704b9795c894
Diffstat (limited to 'include/vcl/opengl')
-rw-r--r--include/vcl/opengl/OpenGLContext.hxx17
1 files changed, 8 insertions, 9 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index c588a215aa86..b520d2c6434a 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -55,6 +55,7 @@ class NSOpenGLView;
#include <vcl/window.hxx>
#include <tools/gen.hxx>
#include <vcl/syschild.hxx>
+#include <rtl/ref.hxx>
#include <map>
#include <set>
@@ -170,7 +171,10 @@ class VCL_DLLPUBLIC OpenGLContext
friend class OpenGLTests;
public:
OpenGLContext();
+ static rtl::Reference<OpenGLContext> Create();
~OpenGLContext();
+ void acquire() { mnRefCount++; }
+ void release() { if ( --mnRefCount == 0 ) delete this; }
void requestLegacyContext();
void requestSingleBufferedRendering();
@@ -194,13 +198,7 @@ public:
OpenGLFramebuffer* AcquireFramebuffer( const OpenGLTexture& rTexture );
static void ReleaseFramebuffer( OpenGLFramebuffer* pFramebuffer );
void UnbindTextureFromFramebuffers( GLuint nTexture );
-#ifdef DBG_UTIL
- void AddRef(SalGraphicsImpl*);
- void DeRef(SalGraphicsImpl*);
-#else
- void AddRef();
- void DeRef();
-#endif
+
void ReleaseFramebuffer( const OpenGLTexture& rTexture );
void ReleaseFramebuffers();
@@ -288,8 +286,9 @@ public:
vcl::Region maClipRegion;
int mnPainting;
- OpenGLContext* mpPrevContext;
- OpenGLContext* mpNextContext;
+ // Don't hold references to ourselves:
+ OpenGLContext *mpPrevContext;
+ OpenGLContext *mpNextContext;
};
#endif