DtkDeclarative
DTK Declarative module
载入中...
搜索中...
未找到
dblitframebuffernode_p.h
1// SPDX-FileCopyrightText: 2021 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DBLITFRAMEBUFFERNODE_H
6#define DBLITFRAMEBUFFERNODE_H
7
8#include <dtkdeclarative_global.h>
9
10#include <QSGTextureProvider>
11#include <QSGRenderNode>
12#include <QPointer>
13
14QT_BEGIN_NAMESPACE
15class QSGPlainTexture;
16class QQuickItem;
17QT_END_NAMESPACE
18
19DQUICK_BEGIN_NAMESPACE
20
21class ProxyAtlasTexture;
22class DBlitFramebufferNode : public QSGRenderNode {
23public:
24 inline QSizeF size() const {
25 return m_size;
26 }
27 QSGTexture *texture() const;
28
29#ifndef QT_NO_OPENGL
30 static DBlitFramebufferNode *createOpenGLNode(QQuickItem *item,
31 bool shareBuffer = false,
32 bool useAtlasTexture = false);
33#endif
34 static DBlitFramebufferNode *createSoftwareNode(QQuickItem *item,
35 bool shareBuffer = false,
36 bool useAtlasTexture = false);
37
38 QRectF rect() const override;
39
40 void resize(const QSizeF &size);
41 void setMargins(const QMarginsF &margin);
42
43 typedef void(*RenderCallback)(DBlitFramebufferNode *node, void *data);
44 void setRenderCallback(RenderCallback callback, void *data);
45 inline void doRenderCallback() {
46 if (!m_renderCallback)
47 return;
48 m_renderCallback(this, m_callbackData);
49 }
50 virtual QImage toImage() const { return QImage(); }
51
52protected:
53 DBlitFramebufferNode(QQuickItem *item);
54
55 QPointer<QQuickItem> m_item;
56 QSizeF m_size;
57 QMarginsF m_margins;
58 QRectF m_rect;
59 QScopedPointer<ProxyAtlasTexture> m_texture;
60 RenderCallback m_renderCallback = nullptr;
61 void *m_callbackData = nullptr;
62 bool shareBuffer = false;
63 bool useAtlasTexture = false;
64};
65
66DQUICK_END_NAMESPACE
67
68#endif // DBLITFRAMEBUFFERNODE_H
Definition dblitframebuffernode_p.h:22