| 1 | // Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB). |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #ifndef QT3DRENDER_RENDER_RENDERSURFACENODE_H |
| 5 | #define QT3DRENDER_RENDER_RENDERSURFACENODE_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists for the convenience |
| 12 | // of other Qt classes. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | |
| 18 | #include <Qt3DRender/private/framegraphnode_p.h> |
| 19 | |
| 20 | QT_BEGIN_NAMESPACE |
| 21 | |
| 22 | class QSurface; |
| 23 | |
| 24 | namespace Qt3DRender { |
| 25 | namespace Render { |
| 26 | |
| 27 | class Q_3DRENDERSHARED_PRIVATE_EXPORT RenderSurfaceSelector : public Qt3DRender::Render::FrameGraphNode |
| 28 | { |
| 29 | public: |
| 30 | RenderSurfaceSelector(); |
| 31 | |
| 32 | QSize renderTargetSize() const; |
| 33 | void setRenderTargetSize(const QSize &size) { m_renderTargetSize = size; } |
| 34 | |
| 35 | void syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime) override; |
| 36 | |
| 37 | QSurface *surface() const { return m_surface; } |
| 38 | inline int width() const noexcept { return m_width; } |
| 39 | inline int height() const noexcept { return m_height; } |
| 40 | inline float devicePixelRatio() const noexcept { return m_devicePixelRatio; } |
| 41 | |
| 42 | private: |
| 43 | QObject *m_surfaceObj; |
| 44 | QSurface *m_surface; |
| 45 | QSize m_renderTargetSize; |
| 46 | int m_width; |
| 47 | int m_height; |
| 48 | float m_devicePixelRatio; |
| 49 | }; |
| 50 | |
| 51 | } // namespace Render |
| 52 | } // namespace Qt3DRender |
| 53 | |
| 54 | QT_END_NAMESPACE |
| 55 | |
| 56 | #endif // QT3DRENDER_RENDER_RENDERSURFACENODE_H |
| 57 | |