Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qohossurfaceimage_p.h
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
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 QOHOSSURFACEIMAGE_P_H
5#define QOHOSSURFACEIMAGE_P_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 purely as an
12// implementation detail. 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 <QtCore/qobject.h>
19#include <QtCore/qmutex.h>
20#include <QtGui/qmatrix4x4.h>
21
22#include <native_image/native_image.h>
23
24#include <atomic>
25
26QT_BEGIN_NAMESPACE
27
28class QOhosSurfaceImage : public QObject
29{
30 Q_OBJECT
31public:
32 explicit QOhosSurfaceImage(uint32_t glTextureId, QObject *parent = nullptr);
33 ~QOhosSurfaceImage() override;
34
35 Q_DISABLE_COPY_MOVE(QOhosSurfaceImage)
36
37 bool isValid() const { return m_image != nullptr; }
38
39 OHNativeWindow *nativeWindow() const { return m_nativeWindow; }
40 QByteArray surfaceId() const { return m_surfaceId; }
41
42 // Must be called on the GL context thread that owns m_textureId.
43 bool updateTexImage();
44 QMatrix4x4 transformMatrix() const;
45
46 quint64 index() const { return m_index; }
47
48signals:
49 void frameAvailable(quint64 index);
50
51private:
52 static void onFrameAvailableTrampoline(void *context);
53
54 OH_NativeImage *m_image{ nullptr };
55 OHNativeWindow *m_nativeWindow{ nullptr };
56 uint32_t m_textureId{ 0 };
57 QByteArray m_surfaceId;
58 quint64 m_index{ 0 };
59 static std::atomic<quint64> s_nextIndex;
60};
61
62QT_END_NAMESPACE
63
64#endif // QOHOSSURFACEIMAGE_P_H
constexpr uint32_t kGlTextureExternalOes