tie lifetime of some objects together
It is just too complicated to follow the different OpenGL contexts in our current desing. This will at least simplify our handling a bit. IOpenGLRenderer is an abstract interface that should be implemented by the code using SdrOpenGLObj to paint with OpenGL. Change-Id: Ib4bfc0350b4345bc27af8bed037c48c11bb67300
This commit is contained in:
@@ -13,22 +13,34 @@
|
|||||||
#include <svx/svdobj.hxx>
|
#include <svx/svdobj.hxx>
|
||||||
#include <vcl/OpenGLContext.hxx>
|
#include <vcl/OpenGLContext.hxx>
|
||||||
|
|
||||||
|
#include <vcl/IOpenGLRenderer.hxx>
|
||||||
|
|
||||||
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
namespace sdr { namespace contact {
|
namespace sdr { namespace contact {
|
||||||
class ViewContact;
|
class ViewContact;
|
||||||
} }
|
} }
|
||||||
|
|
||||||
|
class IOpenGLRenderer;
|
||||||
|
|
||||||
class SVX_DLLPUBLIC SdrOpenGLObj : public SdrObject
|
class SVX_DLLPUBLIC SdrOpenGLObj : public SdrObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual ~SdrOpenGLObj();
|
||||||
virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() SAL_OVERRIDE;
|
virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() SAL_OVERRIDE;
|
||||||
|
|
||||||
OpenGLContext& getOpenGLContext();
|
OpenGLContext& getOpenGLContext();
|
||||||
|
|
||||||
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
|
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
|
||||||
|
|
||||||
|
void setRenderer(IOpenGLRenderer* pRenderer);
|
||||||
|
IOpenGLRenderer* getRenderer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
OpenGLContext maContext;
|
OpenGLContext maContext;
|
||||||
|
|
||||||
|
boost::scoped_ptr<IOpenGLRenderer> mpRenderer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -66,6 +66,7 @@ class SdrModel;
|
|||||||
class SvxDrawPage;
|
class SvxDrawPage;
|
||||||
class SvGlobalName;
|
class SvGlobalName;
|
||||||
class Pair;
|
class Pair;
|
||||||
|
class IOpenGLRenderer;
|
||||||
|
|
||||||
// Dimension arrows change size/position on save/reload (#i59051#)
|
// Dimension arrows change size/position on save/reload (#i59051#)
|
||||||
namespace basegfx
|
namespace basegfx
|
||||||
@@ -881,6 +882,9 @@ class SvxOpenGLObject : public SvxShape
|
|||||||
public:
|
public:
|
||||||
SvxOpenGLObject( SdrObject* pObj ) throw() : SvxShape(pObj){}
|
SvxOpenGLObject( SdrObject* pObj ) throw() : SvxShape(pObj){}
|
||||||
virtual ~SvxOpenGLObject() throw() {}
|
virtual ~SvxOpenGLObject() throw() {}
|
||||||
|
|
||||||
|
void setRenderer(IOpenGLRenderer* pRenderer);
|
||||||
|
IOpenGLRenderer* getRenderer();
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
23
include/vcl/IOpenGLRenderer.hxx
Normal file
23
include/vcl/IOpenGLRenderer.hxx
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||||
|
/*
|
||||||
|
* This file is part of the LibreOffice project.
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef VCL_IOPENGLRENDER_HXX
|
||||||
|
#define VCL_IOPENGLRENDER_HXX
|
||||||
|
|
||||||
|
class IOpenGLRenderer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~IOpenGLRenderer();
|
||||||
|
virtual void operator()() = 0;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
@@ -10,6 +10,12 @@
|
|||||||
#include <svx/svdoopengl.hxx>
|
#include <svx/svdoopengl.hxx>
|
||||||
#include <svx/sdr/contact/viewcontactofopenglobj.hxx>
|
#include <svx/sdr/contact/viewcontactofopenglobj.hxx>
|
||||||
|
|
||||||
|
#include <vcl/IOpenGLRenderer.hxx>
|
||||||
|
|
||||||
|
SdrOpenGLObj::~SdrOpenGLObj()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
sdr::contact::ViewContact* SdrOpenGLObj::CreateObjectSpecificViewContact()
|
sdr::contact::ViewContact* SdrOpenGLObj::CreateObjectSpecificViewContact()
|
||||||
{
|
{
|
||||||
return new sdr::contact::ViewContactOfOpenGLObj(*this);
|
return new sdr::contact::ViewContactOfOpenGLObj(*this);
|
||||||
@@ -29,5 +35,14 @@ void SdrOpenGLObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fra
|
|||||||
SAL_WARN("svx.opengl", "resized opengl drawinglayer object");
|
SAL_WARN("svx.opengl", "resized opengl drawinglayer object");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SdrOpenGLObj::setRenderer(IOpenGLRenderer* pRenderer)
|
||||||
|
{
|
||||||
|
mpRenderer.reset(pRenderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
IOpenGLRenderer* SdrOpenGLObj::getRenderer()
|
||||||
|
{
|
||||||
|
return mpRenderer.get();
|
||||||
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
@@ -50,6 +50,7 @@
|
|||||||
#include "svx/svdview.hxx"
|
#include "svx/svdview.hxx"
|
||||||
#include "svx/svdglob.hxx"
|
#include "svx/svdglob.hxx"
|
||||||
#include "svx/svdstr.hrc"
|
#include "svx/svdstr.hrc"
|
||||||
|
#include <svx/svdoopengl.hxx>
|
||||||
#include <vcl/wmf.hxx>
|
#include <vcl/wmf.hxx>
|
||||||
|
|
||||||
|
|
||||||
@@ -968,4 +969,15 @@ SvxDummyShapeContainer::SvxDummyShapeContainer(uno::Reference< drawing::XShapes
|
|||||||
SvxDummyShapeContainer::~SvxDummyShapeContainer() throw()
|
SvxDummyShapeContainer::~SvxDummyShapeContainer() throw()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SvxOpenGLObject::setRenderer(IOpenGLRenderer* pRenderer)
|
||||||
|
{
|
||||||
|
static_cast<SdrOpenGLObj*>(GetSdrObject())->setRenderer(pRenderer);
|
||||||
|
}
|
||||||
|
|
||||||
|
IOpenGLRenderer* SvxOpenGLObject::getRenderer()
|
||||||
|
{
|
||||||
|
return static_cast<SdrOpenGLObj*>(GetSdrObject())->getRenderer();
|
||||||
|
}
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
Reference in New Issue
Block a user