summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-09-07 22:21:15 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-09-08 17:06:50 +0200
commit61b7d3436fb789fecf460d2b47c7210585f496a5 (patch)
tree8d2d0547dac553be91230ebb4f6ee1b3a723574e /svx
parenteb570808aae8080e2dbb925db6b15cc257b2b9e5 (diff)
tdf#94006 - re-factor and fix OpenGLContext mis-use.
Squashes two related patches from master: 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. Fix mis-use in: gltf rendering, OpenGL canvas, GL transitions & GL capable (charts) Avoid GLX operations on un-initialized contexts. Signed-off-by: Miklos Vajna <vmiklos@collabora.co.uk> Conflicts: vcl/source/opengl/OpenGLContext.cxx vcl/workben/vcldemo.cxx canvas/source/opengl/ogl_spritedevicehelper.hxx Change-Id: I7ea29b544d53bb80b25fa6663d39f345bf8f4e64
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/svdoopengl.hxx4
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofopenglobj.cxx4
-rw-r--r--svx/source/svdraw/svdoopengl.cxx7
3 files changed, 7 insertions, 8 deletions
diff --git a/svx/inc/svdoopengl.hxx b/svx/inc/svdoopengl.hxx
index e30baeacfd0a..8a438ccd24c4 100644
--- a/svx/inc/svdoopengl.hxx
+++ b/svx/inc/svdoopengl.hxx
@@ -30,7 +30,7 @@ public:
virtual ~SdrOpenGLObj();
virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() SAL_OVERRIDE;
- OpenGLContext* getOpenGLContext() { return mpContext;}
+ rtl::Reference<OpenGLContext> getOpenGLContext() { return mpContext;}
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
@@ -41,7 +41,7 @@ public:
private:
- OpenGLContext* mpContext;
+ rtl::Reference<OpenGLContext> mpContext;
boost::scoped_ptr<IOpenGLRenderer> mpRenderer;
};
diff --git a/svx/source/sdr/contact/viewobjectcontactofopenglobj.cxx b/svx/source/sdr/contact/viewobjectcontactofopenglobj.cxx
index 68d7ba130b2f..03c64809ef1d 100644
--- a/svx/source/sdr/contact/viewobjectcontactofopenglobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofopenglobj.cxx
@@ -24,8 +24,8 @@ ViewObjectContactOfOpenGLObj::ViewObjectContactOfOpenGLObj(
: ViewObjectContactOfSdrObj( rObjectContact, rViewContact )
{
#if HAVE_FEATURE_DESKTOP
- OpenGLContext* pContext = static_cast<SdrOpenGLObj&>(static_cast<ViewContactOfSdrObj&>(rViewContact).GetSdrObject()).getOpenGLContext();
- if (pContext)
+ rtl::Reference<OpenGLContext> pContext = static_cast<SdrOpenGLObj&>(static_cast<ViewContactOfSdrObj&>(rViewContact).GetSdrObject()).getOpenGLContext();
+ if (pContext.is())
pContext->init(getWindow());
#endif
}
diff --git a/svx/source/svdraw/svdoopengl.cxx b/svx/source/svdraw/svdoopengl.cxx
index 1b3398359c83..c84f8fb98887 100644
--- a/svx/source/svdraw/svdoopengl.cxx
+++ b/svx/source/svdraw/svdoopengl.cxx
@@ -20,13 +20,12 @@ SdrOpenGLObj::SdrOpenGLObj()
mpContext(NULL)
{
#if HAVE_FEATURE_DESKTOP
- mpContext = new OpenGLContext;
+ mpContext = OpenGLContext::Create();
#endif
}
SdrOpenGLObj::~SdrOpenGLObj()
{
- delete mpContext;
}
sdr::contact::ViewContact* SdrOpenGLObj::CreateObjectSpecificViewContact()
@@ -40,7 +39,7 @@ void SdrOpenGLObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fra
SdrObject::NbcResize(rRef, xFact, yFact);
// now pass the information to the OpenGL context
- if (mpContext)
+ if (mpContext.is())
mpContext->setWinSize(aOutRect.GetSize());
SAL_WARN("svx.opengl", "resized opengl drawinglayer object");
@@ -59,7 +58,7 @@ IOpenGLRenderer* SdrOpenGLObj::getRenderer()
bool SdrOpenGLObj::isOpenGLInitialized()
{
- return mpContext && mpContext->isInitialized();
+ return mpContext.is() && mpContext->isInitialized();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */