Kaydet (Commit) 8091457a authored tarafından Markus Mohrhard's avatar Markus Mohrhard

Revert "use boost::shared_ptr instead of manual ref counting"

This reverts commit 8eeb02dc.

Conflicts:
	include/vcl/opengl/OpenGLContext.hxx
	vcl/inc/openglgdiimpl.hxx
	vcl/opengl/gdiimpl.cxx

Change-Id: I85cc7a46876ffba5ab861f6dd83b07da466b212b
üst 6ae099ff
......@@ -211,6 +211,8 @@ public:
bool AcquireFramebuffer( OpenGLFramebuffer* pFramebuffer );
OpenGLFramebuffer* AcquireFramebuffer( const OpenGLTexture& rTexture );
void ReleaseFramebuffer( OpenGLFramebuffer* pFramebuffer );
void AddRef();
void DeRef();
// retrieve a program from the cache or compile/link it
OpenGLProgram* GetProgram( const OUString& rVertexShader, const OUString& rFragmentShader );
......@@ -260,6 +262,7 @@ private:
SystemChildWindow* m_pChildWindow;
boost::scoped_ptr<SystemChildWindow> m_pChildWindowGC;
bool mbInitialized;
int mnRefCount;
bool mbRequestLegacyContext;
bool mbUseDoubleBufferedRendering;
bool mbRequestVirtualDevice;
......
......@@ -32,8 +32,6 @@
#include <tools/poly.hxx>
#include <vcl/opengl/OpenGLContext.hxx>
#include <boost/shared_ptr.hpp>
class SalFrame;
class SalVirtualDevice;
......@@ -41,7 +39,7 @@ class VCL_PLUGIN_PUBLIC OpenGLSalGraphicsImpl : public SalGraphicsImpl
{
protected:
boost::shared_ptr<OpenGLContext> mpContext;
OpenGLContext* mpContext;
/// Pointer to the SalFrame or SalVirtualDevice
SalGeometryProvider* mpParent;
OpenGLFramebuffer* mpFramebuffer;
......
......@@ -51,20 +51,23 @@ OpenGLSalGraphicsImpl::OpenGLSalGraphicsImpl(SalGeometryProvider* pParent)
OpenGLSalGraphicsImpl::~OpenGLSalGraphicsImpl()
{
ReleaseContext();
}
OpenGLContext* OpenGLSalGraphicsImpl::GetOpenGLContext()
{
if( !mpContext )
AcquireContext();
return mpContext.get();
return mpContext;
}
bool OpenGLSalGraphicsImpl::AcquireContext( )
{
ImplSVData* pSVData = ImplGetSVData();
mpContext.reset();
if( mpContext )
mpContext->DeRef();
OpenGLContext* pContext = pSVData->maGDIData.mpLastContext;
while( pContext )
......@@ -75,16 +78,20 @@ bool OpenGLSalGraphicsImpl::AcquireContext( )
pContext = pContext->mpPrevContext;
}
if (!pContext)
if( pContext )
pContext->AddRef();
else
pContext = mbOffscreen ? CreatePixmapContext() : CreateWinContext();
mpContext.reset(pContext);
return (mpContext != nullptr);
mpContext = pContext;
return (mpContext != NULL);
}
bool OpenGLSalGraphicsImpl::ReleaseContext()
{
mpContext.reset();
if( mpContext )
mpContext->DeRef();
mpContext = NULL;
return true;
}
......@@ -95,7 +102,7 @@ void OpenGLSalGraphicsImpl::Init()
// check if we can simply re-use the same context
if( mpContext )
{
if( !UseContext( mpContext.get() ) )
if( !UseContext( mpContext ) )
ReleaseContext();
}
......
......@@ -53,6 +53,7 @@ OpenGLContext::OpenGLContext():
mpWindow(NULL),
m_pChildWindow(NULL),
mbInitialized(false),
mnRefCount(1),
mbRequestLegacyContext(false),
mbUseDoubleBufferedRendering(true),
mbRequestVirtualDevice(false),
......@@ -121,6 +122,17 @@ OpenGLContext::~OpenGLContext()
#endif
}
void OpenGLContext::AddRef()
{
mnRefCount++;
}
void OpenGLContext::DeRef()
{
if( --mnRefCount == 0 )
delete this;
}
void OpenGLContext::requestLegacyContext()
{
mbRequestLegacyContext = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment