1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <config_features.h>
12 #include <svdoopengl.hxx>
13 #include <sdr/contact/viewcontactofopenglobj.hxx>
15 #include <vcl/opengl/IOpenGLRenderer.hxx>
17 SdrOpenGLObj::SdrOpenGLObj()
19 IOpenGLInfoProvider(),
22 #if HAVE_FEATURE_DESKTOP
23 mpContext
= OpenGLContext::Create();
27 SdrOpenGLObj::~SdrOpenGLObj()
31 sdr::contact::ViewContact
* SdrOpenGLObj::CreateObjectSpecificViewContact()
33 return new sdr::contact::ViewContactOfOpenGLObj(*this);
37 void SdrOpenGLObj::NbcResize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
)
39 SdrObject::NbcResize(rRef
, xFact
, yFact
);
41 // now pass the information to the OpenGL context
43 mpContext
->setWinSize(aOutRect
.GetSize());
45 SAL_WARN("svx.opengl", "resized opengl drawinglayer object");
48 void SdrOpenGLObj::setRenderer(IOpenGLRenderer
* pRenderer
)
50 mpRenderer
.reset(pRenderer
);
51 mpRenderer
->setInfoProvider(this);
54 IOpenGLRenderer
* SdrOpenGLObj::getRenderer()
56 return mpRenderer
.get();
59 bool SdrOpenGLObj::isOpenGLInitialized()
61 return mpContext
.is() && mpContext
->isInitialized();
64 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */