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 <vcl/OpenGLContext.hxx>
|
||||
|
||||
#include <vcl/IOpenGLRenderer.hxx>
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
namespace sdr { namespace contact {
|
||||
class ViewContact;
|
||||
} }
|
||||
|
||||
class IOpenGLRenderer;
|
||||
|
||||
class SVX_DLLPUBLIC SdrOpenGLObj : public SdrObject
|
||||
{
|
||||
public:
|
||||
virtual ~SdrOpenGLObj();
|
||||
virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() SAL_OVERRIDE;
|
||||
|
||||
OpenGLContext& getOpenGLContext();
|
||||
|
||||
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
|
||||
|
||||
void setRenderer(IOpenGLRenderer* pRenderer);
|
||||
IOpenGLRenderer* getRenderer();
|
||||
|
||||
private:
|
||||
|
||||
OpenGLContext maContext;
|
||||
|
||||
boost::scoped_ptr<IOpenGLRenderer> mpRenderer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -66,6 +66,7 @@ class SdrModel;
|
||||
class SvxDrawPage;
|
||||
class SvGlobalName;
|
||||
class Pair;
|
||||
class IOpenGLRenderer;
|
||||
|
||||
// Dimension arrows change size/position on save/reload (#i59051#)
|
||||
namespace basegfx
|
||||
@@ -881,6 +882,9 @@ class SvxOpenGLObject : public SvxShape
|
||||
public:
|
||||
SvxOpenGLObject( SdrObject* pObj ) throw() : SvxShape(pObj){}
|
||||
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/sdr/contact/viewcontactofopenglobj.hxx>
|
||||
|
||||
#include <vcl/IOpenGLRenderer.hxx>
|
||||
|
||||
SdrOpenGLObj::~SdrOpenGLObj()
|
||||
{
|
||||
}
|
||||
|
||||
sdr::contact::ViewContact* SdrOpenGLObj::CreateObjectSpecificViewContact()
|
||||
{
|
||||
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");
|
||||
}
|
||||
|
||||
void SdrOpenGLObj::setRenderer(IOpenGLRenderer* pRenderer)
|
||||
{
|
||||
mpRenderer.reset(pRenderer);
|
||||
}
|
||||
|
||||
IOpenGLRenderer* SdrOpenGLObj::getRenderer()
|
||||
{
|
||||
return mpRenderer.get();
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
@@ -50,6 +50,7 @@
|
||||
#include "svx/svdview.hxx"
|
||||
#include "svx/svdglob.hxx"
|
||||
#include "svx/svdstr.hrc"
|
||||
#include <svx/svdoopengl.hxx>
|
||||
#include <vcl/wmf.hxx>
|
||||
|
||||
|
||||
@@ -968,4 +969,15 @@ SvxDummyShapeContainer::SvxDummyShapeContainer(uno::Reference< drawing::XShapes
|
||||
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: */
|
||||
|
Reference in New Issue
Block a user