bump product version to 5.0.4.1
[LibreOffice.git] / svx / source / svdraw / svdoopengl.cxx
blobc84f8fb98887f823310e03252ea246a63cd8aaab
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #include <config_features.h>
12 #include <svdoopengl.hxx>
13 #include <sdr/contact/viewcontactofopenglobj.hxx>
15 #include <vcl/opengl/IOpenGLRenderer.hxx>
17 SdrOpenGLObj::SdrOpenGLObj()
18 : SdrObject(),
19 IOpenGLInfoProvider(),
20 mpContext(NULL)
22 #if HAVE_FEATURE_DESKTOP
23 mpContext = OpenGLContext::Create();
24 #endif
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
42 if (mpContext.is())
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: */