Debian Codegraph @

src/Gui/SoDevicePixelRatioElement.cpp

raw
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 /****************************************************************************
3 * *
4 * Copyright (c) 2024 Pierre-Louis Boyer <[email protected]> *
5 * *
6 * This file is part of FreeCAD. *
7 * *
8 * FreeCAD is free software: you can redistribute it and/or modify it *
9 * under the terms of the GNU Lesser General Public License as *
10 * published by the Free Software Foundation, either version 2.1 of the *
11 * License, or (at your option) any later version. *
12 * *
13 * FreeCAD is distributed in the hope that it will be useful, but *
14 * WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with FreeCAD. If not, see *
20 * <https://www.gnu.org/licenses/>. *
21 * *
22 ***************************************************************************/
23
24
25 #include <Inventor/actions/SoGLRenderAction.h>
26 #include <Inventor/misc/SoState.h>
27
28
29 #include "SoDevicePixelRatioElement.h"
30
31 SO_ELEMENT_SOURCE(SoDevicePixelRatioElement);
32
33 void SoDevicePixelRatioElement::initClass()
34 {
35 SO_ELEMENT_INIT_CLASS(SoDevicePixelRatioElement, SoFloatElement);
36 // Ensure the element is enabled for GLRenderAction
37 SO_ENABLE(SoGLRenderAction, SoDevicePixelRatioElement);
38 }
39
40 void SoDevicePixelRatioElement::init(SoState* state)
41 {
42 SoFloatElement::init(state);
43 data = 1.0f; // Default to a device pixel ratio of 1.0
44 }
45
46 void SoDevicePixelRatioElement::set(SoState* state, float dpr)
47 {
48 SoFloatElement::set(classStackIndex, state, dpr);
49 }
50
51 float SoDevicePixelRatioElement::get(SoState* state)
52 {
53 return SoFloatElement::get(classStackIndex, state);
54 }
55
56 SoDevicePixelRatioElement::~SoDevicePixelRatioElement()
57 {}