/src/qtbase/src/gui/kernel/qplatformgraphicsbuffer.h
Line | Count | Source |
1 | | // Copyright (C) 2016 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 QPLATFORMGRAPHICSBUFFER_H |
5 | | #define QPLATFORMGRAPHICSBUFFER_H |
6 | | |
7 | | // |
8 | | // W A R N I N G |
9 | | // ------------- |
10 | | // |
11 | | // This file is part of the QPA API and is not meant to be used |
12 | | // in applications. Usage of this API may make your code |
13 | | // source and binary incompatible with future versions of Qt. |
14 | | // |
15 | | |
16 | | |
17 | | #include <QtGui/qtguiglobal.h> |
18 | | #include <QtCore/QSize> |
19 | | #include <QtCore/QRect> |
20 | | #include <QtGui/QPixelFormat> |
21 | | #include <QtCore/qflags.h> |
22 | | #include <QtCore/QObject> |
23 | | |
24 | | QT_BEGIN_NAMESPACE |
25 | | |
26 | | class Q_GUI_EXPORT QPlatformGraphicsBuffer : public QObject |
27 | | { |
28 | 0 | Q_OBJECT |
29 | 0 | public: |
30 | 0 | enum AccessType |
31 | 0 | { |
32 | 0 | None = 0x00, |
33 | 0 | SWReadAccess = 0x01, |
34 | 0 | SWWriteAccess = 0x02, |
35 | 0 | TextureAccess = 0x04, |
36 | 0 | HWCompositor = 0x08 |
37 | 0 | }; |
38 | 0 | Q_ENUM(AccessType) Unexecuted instantiation: qt_getEnumMetaObject(QPlatformGraphicsBuffer::AccessType) Unexecuted instantiation: qt_getEnumName(QPlatformGraphicsBuffer::AccessType) |
39 | 0 | Q_DECLARE_FLAGS(AccessTypes, AccessType) |
40 | 0 |
|
41 | 0 | enum Origin { |
42 | 0 | OriginBottomLeft, |
43 | 0 | OriginTopLeft |
44 | 0 | }; |
45 | 0 | Q_ENUM(Origin) Unexecuted instantiation: qt_getEnumMetaObject(QPlatformGraphicsBuffer::Origin) Unexecuted instantiation: qt_getEnumName(QPlatformGraphicsBuffer::Origin) |
46 | 0 |
|
47 | 0 | ~QPlatformGraphicsBuffer(); |
48 | 0 |
|
49 | 0 | AccessTypes isLocked() const { return m_lock_access; } |
50 | | bool lock(AccessTypes access, const QRect &rect = QRect()); |
51 | | void unlock(); |
52 | | |
53 | | virtual bool bindToTexture(const QRect &rect = QRect()) const; |
54 | | |
55 | | virtual const uchar *data() const; |
56 | | virtual uchar *data(); |
57 | | virtual int bytesPerLine() const; |
58 | | int byteCount() const; |
59 | | |
60 | | virtual Origin origin() const; |
61 | | |
62 | 0 | QSize size() const { return m_size; } |
63 | 0 | QPixelFormat format() const { return m_format; } |
64 | | |
65 | | Q_SIGNALS: |
66 | | void unlocked(AccessTypes previousAccessTypes); |
67 | | |
68 | | protected: |
69 | | QPlatformGraphicsBuffer(const QSize &size, const QPixelFormat &format); |
70 | | |
71 | | virtual bool doLock(AccessTypes access, const QRect &rect = QRect()) = 0; |
72 | | virtual void doUnlock() = 0; |
73 | | |
74 | | private: |
75 | | QSize m_size; |
76 | | QPixelFormat m_format; |
77 | | AccessTypes m_lock_access; |
78 | | }; |
79 | | |
80 | | QT_END_NAMESPACE |
81 | | |
82 | | #endif //QPLATFORMGRAPHICSBUFFER_H |